query
stringlengths
9
43.3k
document
stringlengths
17
1.17M
metadata
dict
negatives
sequencelengths
0
30
negative_scores
sequencelengths
0
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Get fixture by key
public static function getFixture($key) { //phpcs:enable $fixturesNamespace = self::_getFixtureNamespace(); if (array_key_exists($key, self::$_fixtures[$fixturesNamespace])) { return self::$_fixtures[$fixturesNamespace][$key]; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getItem(string $key)\n {\n return static::where('key', $key)->first();\n }", "public static function getByKey($key)\n {\n return static::where('key', $key)->first();\n }", "public function retrieve($key = null);", "public function getItem(string $key);", "public function getbyKey($key = '') {\r\n\t\r\n\t\t$sqlQuery = 'SELECT * FROM definition WHERE definition_key = \"'.addslashes($key).'\" LIMIT 1';\r\n\t\treturn $this->find_by_sql($sqlQuery);\r\n\t\t\r\n\t}", "public function getItem($key);", "public function getItem($key);", "public function getByKey($key)\n {\n return $this->model->where('key','=',$key)->first();\n }", "static function get($key) {\n return self::getInstance()\n ->getResourceForKey($key)\n ->get($key);\n }", "public function findByKey($key)\n {\n return $this->get($key);\n }", "public function findByKey($key)\n {\n return $this->get($key);\n }", "public function findByKey($key);", "public function findByKey($key);", "public function findByKey($key);", "public abstract function retrieve($key);", "protected function getFixture( $name ) {\n\t\treturn json_decode( file_get_contents( dirname( __DIR__ ) . \"/fixtures/{$name}.json\" ), true );\n\t}", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);" ]
[ "0.61676174", "0.60259724", "0.6007728", "0.6000973", "0.6000529", "0.5955379", "0.5955379", "0.5935557", "0.586727", "0.5858676", "0.5858676", "0.58580405", "0.58580405", "0.58580405", "0.5768522", "0.57643634", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627", "0.57627" ]
0.75903034
0
Unset fixtures namespace //phpcs:disable
protected static function _unsetFixtureNamespace() { //phpcs:enable $fixturesNamespace = self::_getFixtureNamespace(); unset(self::$_fixtures[$fixturesNamespace]); self::$_fixturesNamespace = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function tearDownAfterClass(): void\n {\n //phpcs:enable\n //clear garbage in memory\n gc_collect_cycles();\n\n $fixtureNamespace = self::_getFixtureNamespace();\n if (isset(self::$_classLevelFixtures[$fixtureNamespace])\n && count(self::$_classLevelFixtures[$fixtureNamespace])\n ) {\n self::_deleteFixtures(self::$_classLevelFixtures[$fixtureNamespace]);\n }\n\n //ever disable secure area on class down\n self::_enableSecureArea(false);\n self::_unsetFixtureNamespace();\n parent::tearDownAfterClass();\n }", "protected function tearDown()\n {\n self::delTree(__DIR__.'/playground');\n }", "public function tearDown() {\n try {\n $this->xpdo->manager->removeObjectContainer('sti.baseClass');\n $this->xpdo->manager->removeObjectContainer('sti.relClassOne');\n\t\t\t$this->xpdo->manager->removeObjectContainer('sti.relClassMany');\n } catch (Exception $e) {\n $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, $e->getMessage(), '', __METHOD__, __FILE__, __LINE__);\n }\n parent::tearDown();\n }", "protected function tearDown(): void\n {\n unset($this->fixture);\n }", "public static function setUpBeforeClass(): void\n {\n //phpcs:enable\n parent::setUpBeforeClass();\n self::_setFixtureNamespace();\n }", "public function actionReset()\n {\n $this->unloadFixtures();\n $this->generateFixtures();\n $this->loadFixtures();\n }", "public function tearDown() {\n\t\tunset($this->reflectionClassPropertyNames);\n\t\tunset($this->persitenceManagerMock);\n\t\tunset($this->reflectionServiceMock);\n\t\tunset($this->fixture);\n\t}", "public function teardown()\n {\n \n }", "public function tearDown()\n {\n $this->_store = null;\n $this->_repository = null;\n\n $path = __DIR__ . \"/docs/rylai\";\n $filesystem = new Filesystem;\n $finder = new Finder();\n\n $finder->files()->in($path);\n $filesystem->remove($finder);\n $filesystem->remove([$path]);\n }", "protected function tearDown(): void\n {\n unset($this->fixture);\n parent::tearDown();\n }", "public function testUntag()\n {\n }", "public function tearDown()\r\n {\r\n $fixture = new JoinAGroupFixtures();\r\n\r\n $fixture->unload($this->em);\r\n\r\n\r\n parent::tearDown();\r\n\r\n $this->em->close();\r\n $this->em = null;\r\n }", "protected function tearDown()\n {\n foreach ($this->loadedFixtures as $fixture) {\n unlink($fixture);\n }\n\n parent::tearDown();\n }", "public function tearDown()\n {\n \\r\\tableDrop(PersistentObject::collectionName())->run($this->fixture->getConnection()->getHandle());\n\n parent::tearDown();\n }", "public function tearDown()\n {\n // Remove all tmp files\n $files = glob($this->getFixturesPath('tmp') . '/*');\n foreach ($files as $file) {\n if (is_file($file)) {\n @unlink($file);\n }\n }\n }", "protected function tearDown() {\n $this->utHelpers->removeElements($this->modx, $this->mc);\n $this->utHelpers->removeResources($this->modx, $this->mc);\n $this->utHelpers->removeSystemSettings($this->modx, $this->mc);\n $this->utHelpers->removenameSpaces($this->modx, $this->mc);\n $this->utHelpers->removeCategories($this->modx, $this->mc);\n\n if (strstr($this->mc->targetRoot, 'unittest')) {\n // $this->utHelpers->rrmdir($this->mc->targetRoot);\n } else {\n die('Not our Target Root!');\n }\n\n $this->mc->modx = null;\n $this->modx = null;\n $this->mc = null;\n }", "public function testTeardown()\n {\n $this->todo('stub');\n }", "public function tearDown()\n {\n $this->removeDirectory(__DIR__.'/en');\n $this->removeDirectory(__DIR__.'/es');\n $this->removeDirectory(__DIR__.'/pt');\n $this->removeFile(__DIR__.'/es.json');\n $this->removeFile(__DIR__.'/en.json');\n $this->removeFile(__DIR__.'/pt.json');\n }", "public function tearDown(): void\n {\n Filesystem::instance()->unlinkRecursive(Configure::readOrFail('Assets.target'), false, true);\n\n parent::tearDown();\n }", "protected function tearDown(): void\n {\n CompanyLoader::resetInstance();\n }", "public function tearDown()\n\t{\n\t\t$this->unLoadDataSets();\n\t\tparent::tearDown();\n\t}", "public function tearDown()\n {\n $this->modx = null;\n $this->crosslinks = null;\n }", "public function setUp() {\n $this->fixture= new NoNativeImports();\n $this->scope= new CompilationUnitScope();\n }", "protected function tearDown(): void\n {\n $fixtureNamespace = self::_getFixtureNamespace();\n if (isset(self::$_methodLevelFixtures[$fixtureNamespace])\n && count(self::$_methodLevelFixtures[$fixtureNamespace])\n ) {\n self::_deleteFixtures(self::$_methodLevelFixtures[$fixtureNamespace]);\n }\n $this->_callModelsDelete();\n $this->_restoreAppConfig();\n parent::tearDown();\n }", "public function testRemoveAll()\n {\n InternalAutoloader::removeAll();\n $this->_assertRemoved();\n }", "protected function tearDown() {\n\t\t$this->Translation_File_Source = null;\n\n\t\tparent::tearDown ();\n\t}", "protected function tearDown()\n {\n $this->class = null;\n }", "function tearDown() {\n // delete your instance\n unset($this->layer0);\n unset($this->layer1);\n }", "public function tearDown(): void\n {\n parent::tearDown();\n\n system('rm -rf ' . __DIR__ . '/twig/cache/*');\n }", "protected function tearDown(): void\n {\n $GLOBALS['TCA'] = $this->backup['TCA'];\n }" ]
[ "0.6272907", "0.62092274", "0.6018833", "0.59688485", "0.5893342", "0.587743", "0.5855352", "0.5844675", "0.58391434", "0.582873", "0.58178234", "0.57966775", "0.57948077", "0.57703036", "0.57476306", "0.5738683", "0.57312846", "0.57285386", "0.5673258", "0.5653192", "0.5631163", "0.5627416", "0.5621712", "0.56167185", "0.5615707", "0.5592376", "0.55907583", "0.55822426", "0.5573374", "0.55655915" ]
0.83529615
0
Delete array of fixtures
protected static function _deleteFixtures($fixtures) { //phpcs:enable foreach ($fixtures as $fixture) { self::deleteFixture($fixture, true); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteAllByID( $array ){\n HasVideo::deleteAll([\n 'hvi_id' => $array\n ]);\n }", "public function testBulkDelete(){\n $this->browse(function (Browser $browser){\n $customFieldGroup = factory(CustomFieldGroup::class)->create();\n\n $browser->loginAs($this->getAnAdmin()->userID, 'admin')\n ->visit('admin/'.\\App::getLocale().'/custom-fields/list')\n ->waitUntilMissing('@spinner')\n ->click('#ID'.$customFieldGroup->customFieldGroupID)\n ->click('#deleteList')\n ->waitFor('.noty_type__success')\n ->assertVisible('.noty_type__success');\n\n CustomFieldGroup::destroy($customFieldGroup->customFieldGroupID);\n });\n }", "public function deleteAll();", "public function testBulkDelete(){\n $this->browse(function (Browser $browser){\n $postType = factory(PostType::class)->create();\n $faker = Factory::create();\n $title = [];\n $description = [];\n $slug = [];\n $isVisible = [];\n foreach (Language::all() as $language){\n $title[$language->slug] = $faker->name(8);\n $description[$language->slug] = $faker->name(15);\n $slug[$language->slug] = $faker->slug;\n $isVisible[$language->slug] = 1;\n }\n\n $category = new Category();\n $category->createdByUserID = 1;\n $category->postTypeID = $postType->postTypeID;\n $category->title = $title;\n $category->description = $description;\n $category->slug = $slug;\n $category->isVisible = $isVisible;\n $category->order = Category::all()->count();\n\n if($category->save()){\n $browser->loginAs($this->getAnAdmin()->userID, 'admin')\n ->visit('admin/'.\\App::getLocale().'/post-type/categorylist/'.$postType->postTypeID)\n ->waitUntilMissing('@spinner')\n ->click('#ID'.$category->categoryID)\n ->click('#deleteList')\n ->waitFor('.noty_type__success')\n ->assertVisible('.noty_type__success');\n\n PostType::find($postType->postTypeID)->delete();\n }\n\n });\n }", "function del_all(){\n\t\t\t$ids = $this->input->post('ids');\n\t\t\tforeach($ids as $id){\n\t\t\t\t$this->_del($id, false);\n\t\t\t}\n\n\t\t}", "public function deleteAll(): void\n {\n $this->data = [];\n }", "public function destroy($arrayIds);", "public function deletes(array $ids);", "public function bulk_destroy(Request $request)\n {\n $items = ComplainSection::find($request->ids);\n\n foreach ($items as $item) {\n //languages\n $languages = Language::all();\n if($languages->count()){\n foreach ($request->language as $language) {\n $trans = ComplainSectionTrans::where('lang', '=', $language)->where('tid', '=', $item->id)->first();\n\n if($trans) {\n $trans->delete();\n }\n }\n $check_items_trans = ComplainSectionTrans::where('tid', '=', $item->id)->first();\n if(!$check_items_trans){\n $item->delete();\n }\n }\n // end languages\n }\n \n Flash::success(trans('backend.deleted_successfully'));\n $Currentlanguage = Lang::getLocale();\n return redirect(''.$Currentlanguage.'/admin/complains-sections');\n }", "protected function tearDown()\n {\n foreach ($this->loadedFixtures as $fixture) {\n unlink($fixture);\n }\n\n parent::tearDown();\n }", "public function testDeleteAll()\n {\n $models = array();\n for ($i = 0; $i < 10; $i++) {\n $models[] = array(\n 'hash_before' => md5(uniqid()),\n 'hash_after' => md5(uniqid()),\n );\n }\n\n $this->createModels('tiny_compressimages/image', $models);\n\n $this->assertEquals(10, $this->_instance->getCollection()->getSize());\n\n $this->_instance->deleteAll();\n\n $this->assertEquals(0, $this->_instance->getCollection()->getSize());\n }", "public function testDelete()\n {\n $this->portrait->delete();\n foreach ($this->portrait->get_images() as $image) {\n $this->assertFileNotExists($image);\n }\n $this->assertFileNotExists($this->portrait->get_alt_file());\n\n $this->totalcms->delete();\n foreach ($this->totalcms->get_images() as $image) {\n $this->assertFileNotExists($image);\n }\n $this->assertFileNotExists($this->totalcms->get_alt_file());\n\n $this->landscape->delete();\n foreach ($this->landscape->get_images() as $image) {\n $this->assertFileNotExists($image);\n }\n $this->assertFileNotExists($this->landscape->get_alt_file());\n\n $this->big->delete();\n foreach ($this->big->get_images() as $image) {\n $this->assertFileNotExists($image);\n }\n $this->assertFileNotExists($this->big->get_alt_file());\n }", "public function purge(){\n\n $escenarios=$this->escenarios;\n $this->precondiciones()->detach();\n $this->aserciones()->detach(); \n \n foreach ($escenarios as $key => $escenario) {\n $escenario->purge();\n }\n\n $this->delete();\n }", "function delete_all_questions($id){\n\tclear_questions($id);\n}", "public function IDeleteBehatTestCollection() {\n $drupal_user = user_load($this->getUserManager()->getCurrentUser()->uid);\n $connection = islandora_get_tuque_connection($drupal_user);\n $repository = $connection->repository;\n $object = islandora_object_load($this->behat_test_collection_pid);\n if(empty($object)) {\n throw new Exception(\"Unable to find the behat test collection in order to delete it.\");\n }\n // try {\n // foreach($object as $datastream) {\n // $object->purgeDatastream($datastream->id);\n // }\n // }\n // catch(Exception $e) {\n // echo(\"WARNING: Could not purge test collection datastream: \" . $datastream->id);\n // }\n\n try {\n $repository->purgeObject($this->behat_test_collection_pid);\n }\n catch(Exception $e) {\n throw new Exception(\"Could not purge the behat test collection. Message: \" . $e->getMessage());\n }\n }", "function deleteDepended(): void\n {\n foreach($this->routeImages as $l_image){ \n $l_image->deleteAll();\n }\n $this->delete();\n \n }", "public function delete(array $ids);", "function test_deleteAll()\n {\n // Arrange\n $cuisine_type1 = \"American\";\n $cuisine_type2 = \"Greek\";\n $test_cuisine1 = new Cuisine($cuisine_type1);\n $test_cuisine1->save();\n $test_cuisine2= new Cuisine($cuisine_type2);\n $test_cuisine2->save();\n\n //Act\n Cuisine::deleteAll();\n $result = Cuisine::getAll();\n\n //Assert\n $this->assertEquals([], $result);\n }", "public function purge()\n {\n $fixtures = array_reverse($this->fixtures);\n $this->info('We have ' . count($fixtures) . ' fixture to unload');\n $repeat = [];\n while (count($fixtures) > 0) {\n $fixture = array_pop($fixtures);\n $this->debug(get_class($fixture) . ' >>> Unloading fixture `' . get_class($fixture->getEntity()));\n $result = $this->unload($fixture);\n\n if (!isset($repeat[get_class($fixture->getEntity())])) {\n $repeat[get_class($fixture->getEntity())] = 0;\n }\n\n switch ($result) {\n case 1:\n $this->info('The fixture `' . get_class($fixture->getEntity()) . '` is unloaded.');\n break;\n case 0:\n if ($repeat[get_class($fixture->getEntity())]++ < 10) {\n $this->warn('We cannot unload the fixture (retry ' . ($repeat[get_class($fixture->getEntity())]) . '/10)');\n $fixtures[] = $fixture;\n sleep((1 + $repeat[get_class($fixture->getEntity())]) * 2);\n } else {\n $this->error('We cannot unload the fixture, no more retry.');\n }\n break;\n default:\n $this->error('Cannot unload this fixture : skip.');\n\n }\n }\n return true;\n }", "function delete_all(){\n $ids = $this->input->post('ids');\n foreach ($ids as $id_product){\n $this->_del($id_product);\n }\n\n }", "public function testDeleteTableWithArrayCriteria()\n {\n $this->assertEquals(9, $this->manager->count(Demo\\Artist::class, 'artistTypeId=?', [1]));\n \n $this->manager->deleteTable(Demo\\Artist::class, array('where'=>'artistTypeId=:id', 'params'=>array(':id'=>1)));\n \n $this->assertEquals(0, $this->manager->count(Demo\\Artist::class, 'artistTypeId=?', [1]));\n\n // sanity check: make sure we didn't delete everything!\n $this->assertEquals(4, $this->manager->count(Demo\\Artist::class));\n }", "public function deleteMultiple(array $ids = []);", "public function deleteMultiple(array $ids = []);", "public function testMassDestroy()\n {\n $this->seed(\\LanguageLinesTableSeeder::class);\n\n $data = [\n 'selected' => [LanguageLine::firstOrFail()->id]\n ];\n\n $admin = User::Role('Administrator')->firstOrFail();\n\n $response = $this->actingAs($admin)->ajax('post', 'admin/languagelines/massdestroy', $data);\n $response->assertStatus(204);\n $this->assertDatabaseMissing('language_lines', [\n 'id' => $data['selected']\n ]);\n }", "public function destroys(Request $request)\n {\n foreach ($request->id as $id) {\n $testimonial = Testimonial::findOrFail($id);\n File::delete(public_path(str_replace('public','storage',$testimonial->foto)));\n $testimonial->delete();\n }\n\n return response()->json([\n 'success' => true,\n 'message' => 'Gambar berhasil dihapus'\n ]);\n }", "public function delete(array $data)\n {\n // $sql = \"DELETE FROM mygtukai WHERE mygtukai.id= 88 OR 1;\"; id nera prilyginamas 88 arba 1 o yra paverciamas i true arba false 1 = true;\n // $sql = \"DELETE FROM mygtukai WHERE mygtukai.id = ? ;\";\n // $stmt = $this->pdo->prepare($sql);\n // $stmt->execute([$data['id']]);\n //$this->pdo->query($sql); // naudoti query tik tada kai 100% patikima parasyta paciu rankomis\n\n }", "public function deleteAllForTarget()\r\n {\r\n $this->getResource()->deleteAllForTarget();\r\n }", "public function deleteAllForTarget()\r\n {\r\n $this->getResource()->deleteAllForTarget();\r\n }", "public function destroy_all();", "public static function deleteCreatedEntities() {\n global $entities;\n\n if (!empty($entities)) {\n foreach ($entities as $key => $val) {\n foreach ($val as $entity_id => $object) {\n if ($object->deleteProgrammatically()) {\n unset($entities[$key][$entity_id]);\n }\n }\n }\n }\n\n /*self::deleteEntities('node', 1);\n self::deleteEntities('taxonomy_term', 0);\n self::deleteEntities('user', 30);\n self::deleteEntities('comment', 0);*/\n }" ]
[ "0.64718163", "0.6463565", "0.63719225", "0.63661814", "0.63646245", "0.62700284", "0.62593114", "0.6247797", "0.62407434", "0.6230865", "0.619717", "0.6192284", "0.6149895", "0.6126914", "0.6123735", "0.61185867", "0.61159915", "0.61088294", "0.6097665", "0.6081254", "0.60633856", "0.6045316", "0.6045316", "0.60363275", "0.60243106", "0.6011824", "0.6002668", "0.6002668", "0.5996999", "0.5993978" ]
0.6939622
0
Delete fixture by key
public static function deleteFixture($key, $secure = false) { //phpcs:enable $fixturesNamespace = self::_getFixtureNamespace(); if (array_key_exists($key, self::$_fixtures[$fixturesNamespace])) { self::callModelDelete(self::$_fixtures[$fixturesNamespace][$key], $secure); unset(self::$_fixtures[$fixturesNamespace][$key]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteItem($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "public function delete($key = '');", "public function delete(string $key);", "public function delData($key);", "public function del($key){ }", "public function del($key);", "function delete($key);", "public function delete($key): void;", "public function delete($key): void;", "abstract public function delete($key);", "abstract public function delete($key);", "public abstract function delete($key);", "public function delete($key)\n {\n }", "public function delete($key)\n {\n }", "public function del(string $key);" ]
[ "0.71146333", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7094611", "0.7076946", "0.70116675", "0.6968587", "0.6916307", "0.69010407", "0.6884512", "0.6874201", "0.6874201", "0.6838775", "0.6838775", "0.68221414", "0.6817955", "0.6817955", "0.68117523" ]
0.74290234
0
Clean config cache of application
protected function _cleanAppConfigCache() { return $this->_getAppCache()->clean(\Magento\Framework\App\Config::CACHE_TAG); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _clearConfig() {\n\t \n\t $config = Mage::getConfig();\t\t\n\t\t$config->deleteConfig('rublon_temp_key');\n\t\t$config->deleteConfig('rublon_start_time');\n\t}", "public function clearCache(): void\n\t{\n\t\t$this->cache->remove('configuration');\n\t}", "public function refreshAPCCache()\n {\n $configModel = new Default_Model_Configuration();\n $server = $configModel->getKey('api_url');\n $hash = isset($server) ? hash('sha1', $server) : '';\n\n $cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);\n\n $cache->delete($hash . '-Database.configs');\n $cache->delete($hash . '-configFile-configurations');\n }", "public function cleanupConfig()\n {\n $this->configRepository->save('app.enable_legacy_src_namespace', false);\n $this->configRepository->set(CONFIG_ORM_METADATA_APPLICATION, '');\n }", "public function reloadConfigurationCache()\n {\n $this->configurationConsulter->clearData();\n $this->configurationConsulter->getData();\n }", "public function configClear()\n {\n Artisan::call('config:clear');\n\n session()->flash('status', 'Config cache cleared');\n\n return back();\n }", "public static function removeConfig()\n {\n self::$config = null;\n }", "public function clearCache()\n {\n if (config('themes.cache.enabled') === true) {\n app('cache')->forget(config('themes.cache.key'));\n }\n }", "public function refreshAPCCache()\n {\n $configModel = new Default_Model_Configuration();\n $server = $configModel->getKey('api_url');\n $hash = isset($server) ? hash('sha1', $server) : '';\n \n $cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);\n\n $cache->delete($hash . '-Output.default-format');\n }", "function clearServerConfig()\n {\n $this->cache->select($this->dbindex_server_config);\n $this->cache->flushDB();\n }", "private function clean() {\n if (file_exists(__DIR__ . '/cache/example')) {\n unlink(__DIR__ . '/cache/example');\n }\n if (file_exists(__DIR__ . '/cache')) {\n rmdir(__DIR__ . '/cache');\n }\n }", "private function delete_config_files() {\n\t\t$this->delete( $this->config_path );\n\t}", "public function removeConfigs()\n {\n /** @var \\Magento\\Framework\\App\\Config\\ConfigResource\\ConfigInterface $configResource */\n $configResource = Bootstrap::getObjectManager()->get(\n '\\Magento\\Framework\\App\\Config\\ConfigResource\\ConfigInterface'\n );\n foreach ($this->cleanup as list($path, $scopeType, $scopeId)) {\n $configResource->deleteConfig($path, $scopeType, $scopeId);\n }\n }", "public function cleanCache()\n {\n $this->load->library('Cachedobjectmanager');\n $this->cachedobjectmanager->cleanup($this->getCacheCollectionName());\n }", "public function clean()\n\t{\n\t\t$this->storage->clean([Cache::ALL => TRUE]);\n\t}", "public function delCachedApis()\n {\n Yii::$app->cache->delete(static::APIS_CACHE_KEY);\n }", "private function cleanBackendsCache()\n {\n $this->localCache = array();\n $this->localCacheCount = 0;\n }", "private function cleanUp()\n {\n foreach (glob($this->getCachePath() . '/*') as $file) {\n\n if (strpos('mimeMap.json', $file) !== false) {\n continue;\n }\n\n if (time() - filemtime($file) >= $this->ttl->inSeconds()) {\n @unlink($file);\n }\n }\n }", "function delete_cached_app_install_list()\n {\n clearos_profile(__METHOD__, __LINE__);\n\n try {\n $file = new File(CLEAROS_CACHE_DIR . \"/\" . self::FILE_INSTALLED_APPS, TRUE);\n if ($file->exists())\n $file->delete();\n } catch (Engine_Exception $e) {\n throw new Engine_Exception(clearos_exception_message($e), CLEAROS_WARNING);\n }\n }", "public function clearConfiguration()\n\t{\n\t\t$this->process_list = array();\n\t\t$this->message_list = array();\n\t\t$this->clearData();\n\t}", "public static function clean_applications_cache( $clear_update_cache = true ) {\n if ( $clear_update_cache ) {\n }\n if (defined('RC_SITE')) {\n $cache_key = 'applications' . constant('RC_SITE');\n } else {\n $cache_key = 'applications';\n }\n RC_Cache::app_cache_delete($cache_key, 'system');\n }", "function uninstall()\n\t{\n\t\tdelete_config_option('is_on_block_cache');\n\t\tdelete_config_option('is_on_template_cache');\n\t\tdelete_config_option('is_on_comcode_page_cache');\n\t\tdelete_config_option('is_on_lang_cache');\n\t}", "public function cleanCache()\r\n {\r\n foreach ($this->aConnectors as $connector)\r\n {\r\n if (is_object($connector))\r\n {\r\n $connector->cleanCache();\r\n }\r\n }\r\n }", "public function cacheClean( )\n {\n\n if( isset($_SESSION['CACHE']) )\n {\n unset($_SESSION['CACHE']);\n }\n\n }", "private static function clearcache()\n {\n foreach (glob(self::$cache_path . '*') as $file) {\n unlink($file);\n }\n }", "public function clearCache()\n {\n Cache::forget($this->getMapRouteCacheKey());\n Cache::forget($this->getUrlRouteCacheKey());\n }", "protected function cleanAllCache()\n\t{\n\t\t$this->cache->clean();\n\t}", "public static function reset()\n {\n $config = Mage::getModel('core/config_data');\n // Reset the original values\n foreach ($this->_originalConfigValues as $value) {\n // $config->reset();\n $config->load($value->getId());\n $config->setValue($value->getValue());\n $config->save();\n }\n // Remove the new config valuse\n foreach ($this->_newConfigValues as $value) {\n // $config->reset();\n $config->load($value->getId());\n $config->delete();\n }\n // Create the values that were removed\n foreach ($this->_removedConfigValues as $value) {\n // $config->reset();\n $config->setPath($value->getPath());\n $config->setValue($value->getValue());\n // Calculate scope\n $scope = ($value->getScope())? $value->getScope() : 'default';\n $config->setScope($scope);\n $config->save();\n }\n unset(\n $config,\n $this->_originalConfigValues,\n $this->_newConfigValues,\n $this->_removedConfigValues\n );\n }", "private function _cleanCaches(){\n\t\t//clear stash cache\n\t\t$stashFileSystem = new StashFileSystem(array('path' => STASH_PATH));\n\t\t$stash = new Stash($stashFileSystem);\n\n\t\t$toClean = array('book', 'album', 'movie', 'storage');\n\t\tforeach( $toClean as $t ){\n\t\t\t$stash->setupKey($t);\n\t\t\t$stash->clear();\n\n\t\t\tif( isset($_SESSION[$t.'s']) ) unset($_SESSION[$t.'s']['list']);\n\t\t}\n\t}", "static function purgeCache()\n {\n $cache =& wfGetMainCache();\n $cache->delete('vp:surveyslist');\n }" ]
[ "0.7499227", "0.7467578", "0.73882216", "0.7356062", "0.7115862", "0.6907391", "0.68293554", "0.6805544", "0.6707809", "0.6644994", "0.6635821", "0.6616366", "0.659377", "0.65935874", "0.6585919", "0.6563934", "0.6544594", "0.65164435", "0.64659107", "0.64572763", "0.6438388", "0.64357567", "0.6435192", "0.64180076", "0.6415177", "0.63830066", "0.634317", "0.6316792", "0.6309734", "0.63043714" ]
0.8007991
0
Restore config values changed during tests
protected function _restoreAppConfig() { foreach ($this->_origConfigValues as $configPath => $origValue) { $this->_updateAppConfig($configPath, $origValue, true, true); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function tearDown()\n {\n $config = Config::getInstance();\n\n $config->setConfigFile();\n }", "public static function reset()\n {\n $config = Mage::getModel('core/config_data');\n // Reset the original values\n foreach ($this->_originalConfigValues as $value) {\n // $config->reset();\n $config->load($value->getId());\n $config->setValue($value->getValue());\n $config->save();\n }\n // Remove the new config valuse\n foreach ($this->_newConfigValues as $value) {\n // $config->reset();\n $config->load($value->getId());\n $config->delete();\n }\n // Create the values that were removed\n foreach ($this->_removedConfigValues as $value) {\n // $config->reset();\n $config->setPath($value->getPath());\n $config->setValue($value->getValue());\n // Calculate scope\n $scope = ($value->getScope())? $value->getScope() : 'default';\n $config->setScope($scope);\n $config->save();\n }\n unset(\n $config,\n $this->_originalConfigValues,\n $this->_newConfigValues,\n $this->_removedConfigValues\n );\n }", "public function getOriginalConfig();", "protected function tearDown()\n {\n parent::tearDown();\n Bootstrap::getInstance()->resetConfiguration();\n if (file_exists('/tmp/config.json')) {\n unlink('/tmp/config.json');\n }\n }", "public function cleanupConfig()\n {\n $this->configRepository->save('app.enable_legacy_src_namespace', false);\n $this->configRepository->set(CONFIG_ORM_METADATA_APPLICATION, '');\n }", "private function _clearConfig() {\n\t \n\t $config = Mage::getConfig();\t\t\n\t\t$config->deleteConfig('rublon_temp_key');\n\t\t$config->deleteConfig('rublon_start_time');\n\t}", "public function testConfigDuplicateConfig(): void\n {\n $this->expectException(BadMethodCallException::class);\n $this->expectExceptionMessage('Cannot reconfigure existing key `test_variant`');\n $settings = [\n 'className' => FakeConnection::class,\n 'database' => ':memory:',\n ];\n ConnectionManager::setConfig('test_variant', $settings);\n ConnectionManager::setConfig('test_variant', $settings);\n }", "public function tearDown(): void\n {\n unset($this->configProvider);\n }", "public function testRestoreEnv()\n {\n Environment::putEnv('_ENVTEST_RESTORED=initial');\n $vars = Environment::getVariables();\n $this->assertEquals('initial', Environment::getEnv('_ENVTEST_RESTORED'));\n\n // Modify enironment\n Environment::putEnv('_ENVTEST_RESTORED=new');\n $this->assertEquals('initial', $vars['env']['_ENVTEST_RESTORED']);\n $this->assertEquals('new', Environment::getEnv('_ENVTEST_RESTORED'));\n\n // Restore\n Environment::setVariables($vars);\n $this->assertEquals('initial', Environment::getEnv('_ENVTEST_RESTORED'));\n }", "public function reload(): void\n {\n try {\n $this->config = $this->dao->load(self::CONFIG_FILENAME);\n } catch (ParseException $e) {\n $this->logger->warning(sprintf(\n 'Could not read config file %s (%s), falling back to default value',\n self::CONFIG_FILENAME,\n $e->getMessage()\n ));\n\n $this->config = [];\n }\n }", "private function resetOriginalConfigForQueueAndConfirmation()\n {\n config(['form_mail.queue' => $this->config['form_mail.queue']]);\n config(['form_mail.confirmation' => $this->config['form_mail.confirmation']]);\n }", "protected function tearDown(): void\n {\n $_ENV = $this->bakEnvVars;\n $_SERVER = $this->bakServerVars;\n }", "public function tearDown()\n\t{\n\t\tConfig::set('application.url', '');\n\t\tConfig::set('application.index', 'index.php');\n\t}", "public function tearDown(): void {\n\t\tunlink(self::$filePath);\n\t\tConfigReader::reset(TestContainer::getContainer());\n\t}", "public function setUp() : void\n {\n parent::setUp();\n\n // avoid conflict by confirming default\n config(array(\n 'app.readonly' => false,\n ));\n }", "public function testGetRawConfig() {\n #$this->assertEquals($rawConfig, $this->get->getRawValues());\n }", "protected function tearDown()\n {\n $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']\n = $this->backup['encryptionKey'];\n }", "public function testConfigAccess()\n\t{\n\t\tforeach ($this->config as $key => $config)\n\t\t{\n\t\t\t$this->assertSame( $config, $this->definition->config( $key ) );\n\t\t}\n\t}", "public static function tearDownAfterClass(): void {\n\t\tif (isset(self::$fileBackup)) {\n\t\t\t$file = fopen(__DIR__ . '/../../config.json', 'w');\n\t\t\tfwrite($file, self::$fileBackup);\n\t\t\tfclose($file);\n\t\t}\n\t}", "public function testConfigSync() {\n $this->assertSession()->titleEquals('Configuration validation | Drupal');\n $this->assertSession()->pageTextContains('The configuration synchronization failed validation.');\n $this->assertSession()->pageTextContains('This import is empty and if applied would delete all of your configuration, so has been rejected.');\n\n // Ensure there is no continuation button.\n $this->assertSession()->pageTextNotContains('Save and continue');\n $this->assertSession()->buttonNotExists('edit-submit');\n }", "public function testConfigImportUpdates() {\n $storage = $this->container->get('config.storage');\n $sync = $this->container->get('config.storage.sync');\n /** @var \\Drupal\\language\\ConfigurableLanguageManagerInterface $language_manager */\n $language_manager = $this->container->get('language_manager');\n\n // Make a change to the site configuration in the default collection.\n $data = $storage->read('system.site');\n $data['name'] = 'English site name';\n $sync->write('system.site', $data);\n\n // Also make a change to the same config object, but using a language\n // override.\n /** @var \\Drupal\\Core\\Config\\StorageInterface $overridden_sync */\n $overridden_sync = $sync->createCollection('language.fr');\n $overridden_sync->write('system.site', ['name' => 'French site name']);\n\n // Before we start the import, the change to the site name should not be\n // present. This action also primes the cache in the config factory so that\n // we can test whether the cached data is correctly updated.\n $config = $this->config('system.site');\n $this->assertNotEquals('English site name', $config->getRawData()['name']);\n\n // Before the import is started the site name should not yet be overridden.\n $this->assertFalse($config->hasOverrides());\n $override = $language_manager->getLanguageConfigOverride('fr', 'system.site');\n $this->assertTrue($override->isNew());\n\n // Start the import of the new configuration.\n $this->configImporter->reset()->import();\n\n // Verify the new site name in the default language.\n $config = $this->config('system.site')->getRawData();\n $this->assertEquals('English site name', $config['name']);\n\n // Verify the overridden site name.\n $override = $language_manager->getLanguageConfigOverride('fr', 'system.site');\n $this->assertEquals('French site name', $override->get('name'));\n }", "protected function tearDown(): void\n {\n parent::tearDown();\n\n if ($this->prevSniffedFile && $this->prevSniffedFile !== $this->file->getFilename()) {\n $this->sniffedVars = [];\n $this->prevSniffedFile = '';\n }\n }", "public function testSettingsCanBeEdited()\n {\n $this->assertSame('1.1', $this->container->get('settings')['httpVersion']);\n $this->container->get('settings')['httpVersion'] = '1.2';\n $this->assertSame('1.2', $this->container->get('settings')['httpVersion']);\n }", "public function testOverriddenDefaults(): void\n {\n $extension = new FlowConfigExtension();\n\n $container = new ContainerBuilder(null);\n $extension->load(['flow_config' => ['defaults' => ['abc' => '123', 'some.other' => true]]], $container);\n\n $configs = $extension->getProcessedConfigs();\n\n self::assertSame([['defaults' => ['abc' => '123', 'some.other' => true]]], $configs);\n }", "function reload_config()\n\t{\n\t\tglobal $userdata, $Cl_root_path;\n\t\t\n\t\tinclude( $Cl_root_path . 'template/' . $userdata[ 'user_skin' ] . '/template' . cfgEx );\n\t\t$this->config = $temp_config;\n\t}", "protected function tearDown()\n {\n\n removeDummyConfigFile();\n }", "protected function tearDown()\n {\n\n removeDummyConfigFile();\n }", "public function testConfigOverride() {\n /** @var \\Drupal\\Core\\Config\\Entity\\ConfigEntityStorage $storage */\n $storage = \\Drupal::entityTypeManager()->getStorage($this->entityTypeId);\n // Prime the cache prior to adding a config override.\n $storage->load($this->entityId);\n\n // Add the config override, and ensure that what is loaded is correct\n // despite the prior cache priming.\n \\Drupal::configFactory()->addOverride(new ConfigOverrider());\n $entity_override = $storage->load($this->entityId);\n $this->assertSame('Overridden label', $entity_override->label);\n\n // Load override free to ensure that loading the config entity again does\n // not return the overridden value.\n $entity_no_override = $storage->loadOverrideFree($this->entityId);\n $this->assertNotSame('Overridden label', $entity_no_override->label);\n $this->assertNotSame($entity_override->_loadStamp, $entity_no_override->_loadStamp);\n\n // Reload the entity and ensure the cache is used.\n $this->assertSame($entity_no_override->_loadStamp, $storage->loadOverrideFree($this->entityId)->_loadStamp);\n\n // Enable overrides and reload the entity and ensure the cache is used.\n $this->assertSame($entity_override->_loadStamp, $storage->load($this->entityId)->_loadStamp);\n }", "public function tearDown() {\n\t\t// do not allow SimpleTest to interpret Elgg notices as exceptions\n\t\t$this->swallowErrors();\n\n\t\tglobal $CONFIG;\n\t\tunset($CONFIG->externals);\n\t\tunset($CONFIG->externals_map);\n\t}", "public static function resetConfigurationSources(): void\n {\n self::$configurationSources = [];\n }" ]
[ "0.68997264", "0.66261005", "0.6593565", "0.64915836", "0.64319944", "0.6340848", "0.6317117", "0.6246516", "0.6120567", "0.6117585", "0.60815006", "0.6075262", "0.6060938", "0.60113513", "0.5918956", "0.5899235", "0.58948916", "0.5868144", "0.5867862", "0.5860888", "0.58133274", "0.57865506", "0.57839656", "0.5777743", "0.57575786", "0.5736383", "0.5736383", "0.57306415", "0.56976765", "0.5674979" ]
0.67680126
1
Process rest exception result.
public function processRestExceptionResult(\Exception $e) { $error = json_decode($e->getMessage(), true); if (json_last_error() !== JSON_ERROR_NONE) { $error['message'] = $e->getMessage(); } //Remove line breaks and replace with space $error['message'] = trim(preg_replace('/\s+/', ' ', $error['message'])); // remove trace and type, will only be present if server is in dev mode unset($error['trace']); unset($error['type']); return $error; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function handleJsonResponse() {\n $this->data = '';\n $response_body = $this->getBody()->getContents();\n if (empty($response_body)) {\n return;\n }\n\n // Allow any exceptions here to bubble up:\n try {\n $data = Json::decode($response_body);\n }\n catch (UnexpectedValueException $e) {\n throw new RestException($this, $e->getMessage(), $e->getCode(), $e);\n }\n\n if (empty($data)) {\n throw new RestException($this, t('Invalid response'));\n }\n\n if (!empty($data['error'])) {\n throw new RestException($this, $data['error']);\n }\n\n if (!empty($data[0]) && count($data) == 1) {\n $data = $data[0];\n }\n\n if (!empty($data['error'])) {\n throw new RestException($this, $data['error']);\n }\n\n if (!empty($data['errorCode'])) {\n throw new RestException($this, $data['errorCode']);\n }\n $this->data = $data;\n return $this;\n }", "public function _handleResponse( )\n {\n if ($this->getLastHttpReturn()['http_code'] == 403)\n {\n throw new Xenmobile_RESTWS_Exception( $this->getLastRequestResult() );\n }\n else\n {\n if ( $this->getLastRequestResult() && is_object($this->getLastRequestResult()) )\n {\n if ( isset( $this->getLastRequestResult()->status ) )\n {\n return ( $this->getLastRequestResult() );\n }\n }\n }\n\n if ($this->getLastRequestResult()->status != 0)\n {\n $this->log( $this->getLastRequestResult(), __METHOD__ );\n }\n\n throw new Xenmobile_RESTWS_Exception( $this->getLastRequestResult()->message, $this->getLastRequestResult()->status );\n }", "public function process() {\n switch ($this->getMethod()) {\n case 'GET':\n $_data = $this->_repo->list($this->getPath()[1]);\n if (!$_data) {\n echo $this->response(500);\n }\n echo $this->response(200, $_data);\n break;\n default:\n throw new Exception('Method Not Allowed');\n }\n }", "protected function _handleException(){ }", "public abstract function handleException();", "public function parse() {\n try {\n parent::parse();\n } catch (SQLParserException $e) {\n // Re-throw as a \\RESTfm\\ResponseException.\n throw new ResponseException('RFMfind SQL error: '.$e->getMessage(), ResponseException::BADREQUEST, $e);\n }\n }", "public function handlePrepareException(\\Throwable $exception): Response;", "protected function substituteResultWithError($e) {\r\n\t\r\n\t\t\t// Printer may not be initialized if the extractRequestParams() fails for the main module\r\n\t\t\tif (!isset ($this->mPrinter)) {\r\n\t\t\t\t// The printer has not been created yet. Try to manually get formatter value.\r\n\t\t\t\t$value = $this->getRequest()->getVal('format', self::API_DEFAULT_FORMAT);\r\n\t\t\t\tif (!in_array($value, $this->mFormatNames))\r\n\t\t\t\t\t$value = self::API_DEFAULT_FORMAT;\r\n\r\n\t\t\t\t$this->mPrinter = $this->createPrinterByName($value);\r\n\t\t\t\tif ($this->mPrinter->getNeedsRawData())\r\n\t\t\t\t\t$this->getResult()->setRawMode();\r\n\t\t\t}\r\n\r\n\t\t\tif ($e instanceof UsageException) {\r\n\t\t\t\t//\r\n\t\t\t\t// User entered incorrect parameters - print usage screen\r\n\t\t\t\t//\r\n\t\t\t\t$errMessage = array (\r\n\t\t\t\t'code' => $e->getCodeString(),\r\n\t\t\t\t'info' => $e->getMessage());\r\n\t\t\t\t\r\n\t\t\t\t// Only print the help message when this is for the developer, not runtime\r\n\t\t\t\tif ($this->mPrinter->getIsHtml() || $this->mAction == 'help')\r\n\t\t\t\t\tApiResult :: setContent($errMessage, $this->makeHelpMsg());\r\n\r\n\t\t\t} else {\r\n\t\t\t\t//\r\n\t\t\t\t// Something is seriously wrong\r\n\t\t\t\t//\r\n\t\t\t\t$errMessage = array (\r\n\t\t\t\t\t'code' => 'internal_api_error',\r\n\t\t\t\t\t'info' => \"Exception Caught: {$e->getMessage()}\"\r\n\t\t\t\t);\r\n\t\t\t\tApiResult :: setContent($errMessage, \"\\n\\n{$e->getTraceAsString()}\\n\\n\");\r\n\t\t\t}\r\n\r\n\t\t\t$this->getResult()->reset();\r\n\t\t\t$this->getResult()->addValue(null, 'error', $errMessage);\r\n\r\n\t\treturn $errMessage['code'];\r\n\t}", "public function handle_exception($Int_Code){}", "private function handleErrors($e) {\n\t\tif (!isset($e->jsonBody)) {\n\t\t\treturn $this->getCommonError(\"general\");\n\t\t}\n\t\t$body = $e->jsonBody;\n\t\t$error = array(\n\t\t\t'is_error' => true, // helper to detect error\n\t\t\t'status_code' => $e->getHttpStatus()\n\t\t);\n\t\tswitch($body['error']['type']) {\n\t\t\tcase \"invalid_request_error\":\n\t\t\t\tif(isset($body['error']['param'])){\n\t\t\t\t\t$error[$body['error']['param']] = $body['error']['message'];\n\t\t\t\t}else{\n\t\t\t\t\t$error['message'] = $body['error']['message'];\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\tcase \"authentication_error\":\n\t\t\t\t// Don't use the actual error (as it may contain an API key, albeit invalid), rather a general auth error\n\t\t\t\t$error['message'] = Language::_(\"Stripe_plus_gateway.!error.auth\", true);\n\t\t\tbreak;\n\t\t\tcase \"api_connection_error\":\n\t\t\tcase \"api_error\":\n\t\t\tcase \"rate_limit_error\":\n\t\t\t\t$error['message'] = $body['error']['message'];\n\t\t\tbreak;\n\t\t\tcase \"card_error\":\n\t\t\t\t$error[$body['error']['code']] = $body['error']['message'];\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn $this->getCommonError(\"general\");\n\t\t\tbreak;\n\t\t}\n\t\t$this->setErrors(array($body['error']['type'] => $error));\n\t\treturn $error;\n\t}", "public function process()\n {\n try {\n $response = $this->guzzle->send($this->currentRequest);\n } catch (ClientException $exception) {\n if ($exception->getCode() == 403) {\n throw new UnauthorizedBaeException('API needs authentication.');\n }\n throw new InvalidBaePIException('Unknown API error.');\n } catch (Exception $exception) {\n throw new InvalidBaePIException('Unable to process request.');\n }\n\n $this->populateHeaders($response);\n\n $this->checkCallCount();\n\n $body = $response->getBody()->getContents();\n\n $result = json_decode($body);\n $result = new Generic($result);\n\n return $result;\n }", "public function getResult(): void\n {\n throw $this->exception;\n }", "static function exception_out($e)\n {\n HttpResp::json_out($e->getCode(),[\"errors\"=>[[\"message\"=>$e->getMessage()]]]);\n }", "private function handleException($exception)\n {\n $responseBody = $exception->getResponse()->getBody()->getContents();\n\n if (!empty($responseBody)) {\n $responseBody = json_decode($responseBody);\n\n $validationErrorResponse = [\n \"CODE\" => config('httpCodes.required'),\n \"MESSAGE\" => $responseBody->message,\n \"LINE\" => $exception->getLine(),\n \"FILE\" => $exception->getFile(),\n ];\n\n (new Response($validationErrorResponse, config('httpCodes.success')))->header('Content-Type', 'application/json')->send();\n exit;\n }\n }", "public function genericErrorAction()\n {\n $response = $this->Response();\n $errorCode = $this->Request()->getParam('code', 503);\n $response->setStatusCode($errorCode);\n\n if ($this->Request()->getModuleName() === 'frontend') {\n $this->View()->assign('Shop', Shopware()->Shop());\n }\n\n $error = $this->Request()->getParam('error_handler');\n\n /*\n * If the system is configured to display the exception data, we need\n * to pass it to the template\n */\n if ($this->Front()->getParam('showException') || $this->Request()->getModuleName() === 'backend') {\n $path = Shopware()->Container()->getParameter('kernel.root_dir') . '/';\n\n /** @var \\Exception $exception */\n $exception = $error->exception;\n $errorFile = $exception->getFile();\n $errorFile = str_replace($path, '', $errorFile);\n\n $errorTrace = $error->exception->getTraceAsString();\n $errorTrace = str_replace($path, '', $errorTrace);\n $this->View()->assign([\n 'exception' => $exception,\n 'error' => $exception->getMessage(),\n 'error_message' => $exception->getMessage(),\n 'error_file' => $errorFile,\n 'error_trace' => $errorTrace,\n ]);\n }\n\n if ($this->View()->getAssign('success') !== null) {\n $this->Response()->setStatusCode(200);\n $this->View()->clearAssign('exception');\n $this->View()->assign('message', $error->exception->getMessage());\n }\n }", "public function restResponseAction()\n {\n Dm_Log::Error(__METHOD__);\n try {\n switch ($this->getRequest()->getMethod()) {\n case 'GET' :\n $response = $this->_readResponse();\n break;\n default:\n throw new BadMethodCallException(\"Method not recognized\");\n }\n } catch (BadMethodCallException $exc) {\n $this->getResponse()->setHttpResponseCode(405);\n $response = array(\"error\" => $exc->getMessage());\n } catch (InvalidArgumentException $exc) {\n $this->getResponse()->setHttpResponseCode(401);\n $response = array(\"error\" => $exc->getMessage());\n } catch (Exception $exc) {\n $this->getResponse()->setHttpResponseCode(500);\n $response = array(\"error\" => $exc->getMessage());\n }\n\n $this->_helper->json($response, true);\n }", "public function executeRequestException()\n {\n $request = new Request();\n $request->setMethod(Request::METHOD_GET);\n\n $endpoint = new Endpoint(\n array(\n 'scheme' => 'silly', //invalid protocol\n )\n );\n\n $this->adapter->execute($request, $endpoint);\n }", "private function checkError($res)\n{\n if ($res === FALSE) {\n $err = $this->db->errorInfo();\n $msg = \"SQLSTATE: \" . $err[0] . \"\\nDriver error code: \" . $err[1] . \"\\nDriver error message: \" . $err[2];\n throw new RESTException($msg, 500);\n }\n}", "private function processCurrentError()\n {\n $traces = [];\n foreach ($this->exception->getTrace() as $key => $trace) {\n $args = $this->getArgs(Arr::get($trace, \"args\", []), 0);\n $newTrace = Arr::except($trace, [\"args\"]);\n $newTrace[\"args\"] = $args;\n $traces[$key] = $newTrace;\n if (count($traces) >= $this->maxTraces) {\n break;\n }\n }\n $session = \"Not set\";\n if ($this->request->hasSession()) {\n $session = $this->request->session()->all();\n }\n return [\n \"url\" => $this->request->url(),\n \"file\" => $this->exception->getFile(),\n \"line\" => $this->exception->getLine(),\n \"type\" => $this->getErrorType(),\n \"exception\" => get_class($this->exception),\n \"message\" => $this->exception->getMessage(),\n \"trace\" => $traces,\n \"reportar\" => 1,\n \"request\" => [\n \"path\" => $this->request->path(),\n \"query\" => $this->request->query(),\n \"method\" => $this->request->method(),\n \"data\" => $this->request->all(),\n \"session\" => $session,\n \"cookie\" => $this->request->cookie(),\n \"ip\" => $this->request->ip(),\n \"header\" => collect($this->request->header())->only([\n \"user-agent\",\n \"referer\",\n \"accept-language\",\n ])->all(),\n \"accepts\" => $this->request->getAcceptableContentTypes(),\n \"server\" => collect($this->request->server())->only([\n \"REDIRECT_STATUS\",\n \"DOCUMENT_ROOT\",\n \"REQUEST_SCHEME\",\n \"REDIRECT_URL\",\n \"REDIRECT_QUERY_STRING\"\n ])->all(),\n ],\n ];\n }", "function mod_bongo_handle_rest_errors($parsedresponse) {\n $moodleerror = new stdClass();\n $errorexists = false;\n $errormessage = false;\n if (!is_null($parsedresponse->message)) {\n $message = $parsedresponse->message;\n switch ($message) {\n case 'Internal server error':\n case 'POST body missing accessCode':\n case 'POST body missing region':\n case 'POST body missing Institution Name':\n case 'POST body missing Class lms code':\n case 'POST body missing timezone':\n case 'No Token': // For contacting Bongo, not the GSS.\n case 'Institution not created':\n case 'Invalid backend':\n $errorexists = true;\n $errormessage = get_string('bongoresterror', 'mod_bongo');\n break;\n case 'Invalid accessCode':\n $errorexists = true;\n $errormessage = get_string('bongoresterrorinvalidtoken', 'mod_bongo');\n break;\n case 'Expired accessCode':\n $errorexists = true;\n $errormessage = get_string('bongoresterrorexpiredtoken', 'mod_bongo');\n break;\n default:\n // No known errors were found! Give a generic error.\n $errorexists = true;\n $errormessage = get_string('bongoresterror', 'mod_bongo');\n break;\n }\n } else if (is_null($parsedresponse->url)) {\n $errorexists = true;\n $errormessage = get_string('bongoresterror', 'mod_bongo');\n }\n $moodleerror->errorexists = $errorexists;\n $moodleerror->errormessage = $errormessage;\n\n return $moodleerror;\n}", "function throwException (&$body, $exception) {\n\t\t$body->responseURI = $body->responseIndex . \"/onStatus\";\n\t\t$results = &$body->getResults();\n\n\t\tif($GLOBALS['amfphp']['encoding'] == 'amf3')\n\t\t{\n\t\t\t$errorMessageClass = conf(\"options/debug-mode\", false, false) ? \"AerialErrorMessage\" : \"ErrorMessage\";\n\n\t\t\t$results = new $errorMessageClass();\n\t\t\t$results->correlationId = $GLOBALS['amfphp']['lastMessageId'];\n\t\t\t$results->faultCode = $exception->code;\n\t\t\t$results->faultDetail = $exception->details . ' on line ' . $exception->line;\n\t\t\t$results->faultString = $exception->description;\n\t\t\tif(conf(\"options/debug-mode\", false, false))\n\t\t\t\t$results->debug = $exception->debug;\n\t\t}\n\t\telseif($GLOBALS['amfphp']['encoding'] == 'amf0')\n\t\t{\n\t\t\t$results[\"description\"] = $exception->description;\n\t\t\t$results[\"details\"] = $exception->details;\n\t\t\t$results[\"level\"] = $exception->level;\n\t\t\t$results[\"line\"] = $exception->line;\n\t\t\t$results[\"code\"] = $exception->code;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$results['faultCode'] = $exception->code;\n\t\t\t$results['faultDetail'] = $exception->details . ' on line ' . $exception->line;\n\t\t\t$results['faultString'] = $exception->description;\n\t\t}\n\t}", "function handleInvalidErrors($e){\n if( $e->getApiErrorCode() == \"invalid_state_for_request\") {\n\t // Error due to invalid state to perform the API call.\n \t error_log(\"Error : \" . json_encode($e->getJSONObject()));\n\t $errorResponse = array(\"error_msg\" => \"Invalid state for this operation\");\n \t print json_encode($errorResponse, true);\n\t header(\"HTTP/1.0 400 Invalid Request\");\n } else {\n \t handleInvalidRequestException($e);\n } \n}", "public function handleResponseException(\\Throwable $exception): Response;", "public function analyzeResult(){\n try{\n if( $this->resultSet )\n {\n if( $this->resultSet->code == \"200\" ){\n return $this->resultSet;\n }else{\n throw new \\Exception( $this->resultSet->message );\n }\n }else {\n throw new \\Exception( 'Result was empty' );\n }\n }catch( \\Exception $e ){\n EmailLabsErrorHandler::setError(__CLASS__, 'Error', $e->getMessage());\n }\n }", "protected function processException(RequestException $e)\n {\n \t$body = \"\";\n $response = $e->getResponse();\n \t\n \tif ($response == null) {\n \t throw $e;\n \t} else {\n \t $body = (string) $response->getBody();\n throw new AlmaException($body);\n \t}\n }", "function errorCatch($response) {\n $err_msg = $this->getAttribute($response, \"err\", Null, \"msg\");\n $err_code = $this->getAttribute($response, \"err\", Null, \"code\");\n if ($err_msg) {\n if ($err_code == 100) {\n user_error(_t('FlickrService.NOAPIKEY', 'You need to set the Flickr API key so that your SilverStripe website is permitted to commnicate with Flickr.<br/>Get one at http://www.flickr.com/services/api/keys/apply/ and add the code to mysite/_config.php, e.g: <br/> FlickrService::setAPIKey(\\'YOUR-KEY-HERE\\'); '), E_USER_ERROR);\n } else {\n user_error(sprintf(_t('FlickrService.FLICKRSERVICEERROR', \"Flickr Service Error : %s\"), $err_msg), E_USER_ERROR);\n }\n } else {\n return $response;\n }\n }", "public function _exceptionProcess($error = false)\n {\n $params = $this->auth_response;\n $order = $this->_getOrder();\n $transid = $this->getTransId();\n\n $exception = '';\n $exception_temp = explode('^', $params['X_RESPONSE_REASON_TEXT']);\n $exception = array_shift($exception_temp);\n\n if (!empty($exception)) {\n try {\n $this->_getCheckout()->setLastSuccessQuoteId($order->getQuoteId());\n $this->_getCheckout()->addError($exception);\n $order->getPayment()->setLastTransId($transid);\n $status = $error ? Innobyte_Plationline_Model_Api::ERROR_PO_STATUS : Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;\n $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $status, $exception);\n Mage::log('ITSN: ' . ($this->itsn ? '1' : '0') . ' , exceptionProcess State: ' . Mage_Sales_Model_Order::STATE_PROCESSING, null, 'statelog.log');\n $order->addStatusToHistory($status, $exception);\n $order->save();\n } catch (Exception $e) {\n Mage::log('Order ' . $order->getIncrementId() . ' can not be save for system reason ' . $e->getMessage(), null, 'plationline.log');\n $this->_getCheckout()->addError($exception);\n }\n } else {\n $this->_getCheckout()->addError(Mage::helper('plationline')->__('Exception not defined'));\n }\n\n if (!$this->itsn) {\n $relay_method = Mage::getStoreConfig('payment/plationline/relay_method');\n if ($relay_method != 'PTOR') {\n header('User-Agent:Mozilla/5.0 (Plati Online Relay Response Service)');\n header('PO_Transaction_Response_Processing: true');\n if ($relay_method == 'POST_S2S_MT_PAGE' || $relay_method == 'SOAP_MT_PAGE') {\n\n if (empty($exception)) {\n $exception = $this->__('Exception not defined');\n }\n\n $response_data = array(\n 'order' => $order,\n 'transid' => $transid,\n 'exception' => $exception,\n 'po_data' => $params,\n );\n\n echo $this->createResponseBlock($response_data, false);\n }\n\n return;\n }\n\n $this->_redirect('checkout/onepage/success');\n }\n\n }", "protected function process()\n {\n $this->result = $this[self::RESPONSE_PROCESSING] == self::TYPE_RAW\n ? $this->request->getResponse()\n : $this->getResponseParser()->parse($this);\n }", "public static function handleEndpointException($exception) {\n echo APIResponseBuilder::buildResponse(500, $exception);\n exit();\n }", "abstract protected function handleResult($code, $headers, $data);" ]
[ "0.63148254", "0.6176469", "0.5913114", "0.5886402", "0.58612627", "0.5810752", "0.57788503", "0.57193744", "0.5692889", "0.56720835", "0.5643644", "0.563992", "0.5634676", "0.5598764", "0.55925435", "0.5578134", "0.55532086", "0.55473983", "0.55183166", "0.5481216", "0.5476303", "0.54671293", "0.54612595", "0.54551166", "0.54398054", "0.54283047", "0.539365", "0.5388342", "0.53645504", "0.53322965" ]
0.69741887
0
This method will add custom fields so that vendor's can modify their pdf invoice number
public function vendor_dashboard_custom_pdf_fields( $store_id ) { $invoice_settings = get_user_meta( $store_id, 'dokan_wcpdf_documents_settings_invoice', true ); if ( empty( $invoice_settings ) ) { $invoice_settings = [ 'override_invoice_num' => 0, 'invoice_number' => 1, 'number_format_prefix' => '', 'number_format_suffix' => '', 'number_format_padding' => 0, 'reset_number_yearly' => 0, ]; } ?> <div class="dokan-form-group"> <label class="dokan-w3 dokan-control-label" for="dokan_wcpdf_documents_settings_invoice_override"><?php esc_html_e( 'Override Invoice Number?', 'dokan' ); ?></label> <div class="dokan-w5 dokan-text-left"> <input type="checkbox" id="dokan_wcpdf_documents_settings_invoice_override" name="dokan_wcpdf_documents_settings_invoice[override_invoice_num]" value="1" <?php echo checked( '1', $invoice_settings['override_invoice_num'] ); ?>> </div> </div> <div id="dokan_wcpdf_documents_settings_fields" style="display: <?php echo absint( $invoice_settings['override_invoice_num'] ) === 1 ? 'block' : 'none'; ?>;"> <div class="dokan-form-group"> <label class="dokan-w3 dokan-control-label" for="dokan_wcpdf_documents_settings_invoice_number"><?php esc_html_e( 'Next invoice number (without prefix/suffix etc.)', 'dokan' ); ?></label> <div class="dokan-w5 dokan-text-left"> <input id="dokan_wcpdf_documents_settings_invoice_number" value="<?php echo esc_attr( $invoice_settings['invoice_number'] ); ?>" name="dokan_wcpdf_documents_settings_invoice[invoice_number]" class="dokan-form-control input-md" type="number" size="10" min="1" step="1"> <div class="help-block"><?php esc_html_e( 'This is the number that will be used for the next document. By default, numbering starts from 1 and increases for every new document. Note that if you override this and set it lower than the current/highest number, this could create duplicate numbers!', 'dokan' ); ?></div> </div> </div> <div class="dokan-form-group"> <label class="dokan-w3 dokan-control-label"><?php esc_html_e( 'Invoice Number Format', 'dokan' ); ?></label> <div class="dokan-w5 dokan-text-left"> <input type="text" id="dokan_wcpdf_documents_settings_invoice_prefix" name="dokan_wcpdf_documents_settings_invoice[number_format][prefix]" value="<?php echo esc_attr( $invoice_settings['number_format_prefix'] ); ?>" size="20" placeholder="<?php esc_attr_e( 'Prefix', 'dokan' ); ?>"><br> <div class="help-block"><?php esc_html_e( 'to use the invoice year and/or month, use [invoice_year] or [invoice_month] respectively', 'dokan' ); ?></div><br> <input type="text" id="dokan_wcpdf_documents_settings_invoice_suffix" name="dokan_wcpdf_documents_settings_invoice[number_format][suffix]" value="<?php echo esc_attr( $invoice_settings['number_format_suffix'] ); ?>" size="20" placeholder="<?php esc_attr_e( 'Suffix', 'dokan' ); ?>"><br><br> <input type="number" id="dokan_wcpdf_documents_settings_invoice_padding" name="dokan_wcpdf_documents_settings_invoice[number_format][padding]" value="<?php echo esc_attr( $invoice_settings['number_format_padding'] ); ?>" size="20" min="0" step="1" placeholder="<?php esc_attr_e( 'Padding', 'dokan' ); ?>"><br> <div class="help-block"><?php esc_html_e( 'enter the number of digits here - enter "6" to display 42 as 000042', 'dokan' ); ?></div> </div> </div> <div class="dokan-form-group"> <label class="dokan-w3 dokan-control-label" for="dokan_wcpdf_documents_settings_invoice_reset"><?php esc_html_e( 'Reset invoice number yearly', 'dokan' ); ?></label> <div class="dokan-w5 dokan-text-left"> <input type="checkbox" id="dokan_wcpdf_documents_settings_invoice_reset" name="dokan_wcpdf_documents_settings_invoice[reset_number_yearly]" value="1" <?php echo checked( '1', $invoice_settings['reset_number_yearly'] ); ?>> </div> </div> </div> <script> ;(function( $, document ) { 'use strict'; const Dokan_PDF_Invoce_Settings = { init: function () { Dokan_PDF_Invoce_Settings.hide_invoice_fields(); $('#dokan_wcpdf_documents_settings_invoice_override').on( 'change', Dokan_PDF_Invoce_Settings.hide_invoice_fields ); }, hide_invoice_fields: function () { if ( $('#dokan_wcpdf_documents_settings_invoice_override').is(':checked') ) { $('#dokan_wcpdf_documents_settings_fields').fadeIn(); } else { $('#dokan_wcpdf_documents_settings_fields').fadeOut(); } }, }; $( document ).ready( function () { Dokan_PDF_Invoce_Settings.init(); } ); })(jQuery, document); </script> <?php }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function addAdditionalFields() {\n\n\t}", "function ic_image_attachment_add_custom_fields($form_fields, $post) {\n\t$form_fields[\"ic-custom-field\"] = array(\n\t\t\"label\" => __(\"Photo Credit\"),\n\t\t\"input\" => \"text\",\n\t\t\"value\" => get_post_meta($post->ID, \"ic-custom-field\", true),\n\t\t//\"helps\" => __(\"This descriptions appears below input field.\"),\n\t);\n\treturn $form_fields;\n}", "public function add_actions() {\n // enable pdf invoice number override by other plugin\n add_filter( 'wpo_wcpdf_external_invoice_number_enabled', '__return_true' );\n\n // add custom meta on vendor dashboard settings page\n add_action( 'dokan_settings_before_store_email', [ $this, 'vendor_dashboard_custom_pdf_fields' ], 10, 1 );\n\n //save vendor dashboard custom fields data\n add_action( 'dokan_store_profile_saved', [ $this, 'save_vendor_dashboard_custom_pdf_fields' ], 10, 1 );\n\n // generate dynamic invoice number for vendors\n add_filter( 'wpo_wcpdf_external_invoice_number', [ $this, 'generate_invoice_number' ], 10, 2 );\n\n // change pdf filename\n add_filter( 'wpo_wcpdf_filename', [ $this, 'wcpdf_filename' ], 10, 4 );\n }", "protected function addPaymentFields(): void\n {\n $this->addField(\n 'paymentMethod',\n [\n 'value' => 'credit',\n 'options' => [\n ['value' => 'credit', 'label' => 'Credit card'],\n ['value' => 'debit', 'label' => 'Debit card'],\n ['value' => 'paypal', 'label' => 'PayPal'],\n ]\n ]\n );\n\n $this->addField('creditCardName')\n ->setFieldLabel('Name on card')\n ->setFieldInfo('Full name as displayed on card')\n ->isRequired();\n\n $this->addField('creditCardNumber')\n ->setFieldLabel('Credit card number')\n ->isRequired();\n\n $this->addField('creditCardExpiration')\n ->setFieldLabel('Expiration')\n ->isRequired();\n\n $this->addField('cvv')\n ->setFieldLabel('CVV')\n ->setFieldInvalidFeedback('Security code required')\n ->isRequired();\n }", "function createCustomFields() {\n if ( function_exists( 'add_meta_box' ) ) {\n foreach ( $this->postTypes as $postType ) {\n add_meta_box( 'jvfrm-post-custom-fields', 'Additional information', array( &$this, 'displayCustomFields' ), $postType, 'normal', 'high' );\n }\n }\n }", "public function addFields() {}", "public function search_fields ( $custom_fields ) {\n\t\t$custom_fields[] = '_wcpdf_invoice_number';\n\t\t$custom_fields[] = '_wcpdf_formatted_invoice_number';\n\t\treturn $custom_fields;\n\t}", "function af_rcp_add_member_edit_fields( $user_id = 0 ) {\n\n\t$cif = get_user_meta( $user_id, 'rcp_cif', true );\t\n\t$codpost = get_user_meta( $user_id, 'rcp_codpost', true );\n\t$direccion = get_user_meta( $user_id, 'rcp_direccion', true );\n\t$ciudad = get_user_meta( $user_id, 'rcp_ciudad', true );\n\t$vatnumber = get_user_meta( $user_id, 'rcp_vatnumber', true );\n\n\n\t?>\n\t<tr valign=\"top\">\n\t\t<th scope=\"row\" valign=\"top\">\n\t\t\t<label for=\"rcp_cif\"><?php _e( 'DNI / CIF', 'rcp' ); ?></label>\n\t\t</th>\n\t\t<td>\n\t\t\t<input name=\"rcp_cif\" id=\"rcp_cif\" type=\"text\" value=\"<?php echo esc_attr( $cif ); ?>\"/>\n\t\t\t<p class=\"description\"><?php _e( 'DNI / CIF', 'rcp' ); ?></p>\n\t\t</td>\n\t</tr>\n\n\t<tr valign=\"top\">\n\t\t<th scope=\"row\" valign=\"top\">\n\t\t\t<label for=\"rcp_codpost\"><?php _e( 'Código postal', 'rcp' ); ?></label>\n\t\t</th>\n\t\t<td>\n\t\t\t<input name=\"rcp_codpost\" id=\"rcp_codpost\" type=\"text\" value=\"<?php echo esc_attr( $codpost ); ?>\"/>\n\t\t\t<p class=\"description\"><?php _e( 'Código postal', 'rcp' ); ?></p>\n\t\t</td>\n\t</tr>\n\n\t<tr valign=\"top\">\n\t\t<th scope=\"row\" valign=\"top\">\n\t\t\t<label for=\"rcp_direccion\"><?php _e( 'Dirección', 'rcp' ); ?></label>\n\t\t</th>\n\t\t<td>\n\t\t\t<input name=\"rcp_direccion\" id=\"rcp_direccion\" type=\"text\" value=\"<?php echo esc_attr( $direccion ); ?>\"/>\n\t\t\t<p class=\"description\"><?php _e( 'Dirección', 'rcp' ); ?></p>\n\t\t</td>\n\t</tr>\n\t\n\t<tr valign=\"top\">\n\t\t<th scope=\"row\" valign=\"top\">\n\t\t\t<label for=\"rcp_ciudad\"><?php _e( 'Ciudad', 'rcp' ); ?></label>\n\t\t</th>\n\t\t<td>\n\t\t\t<input name=\"rcp_ciudad\" id=\"rcp_ciudad\" type=\"text\" value=\"<?php echo esc_attr( $ciudad ); ?>\"/>\n\t\t\t<p class=\"description\"><?php _e( 'Ciudad', 'rcp' ); ?></p>\n\t\t</td>\n\t</tr>\n\t<tr valign=\"top\">\n\t\t<th scope=\"row\" valign=\"top\">\n\t\t\t<label for=\"rcp_vatnumber\"><?php _e( 'Introduce número VAT', 'rcp' ); ?></label>\n\t\t</th>\n\t\t<td>\n\t\t\t<input name=\"rcp_vatnumber\" id=\"rcp_vatnumber\" type=\"text\" value=\"<?php echo esc_attr( $vatnumber ); ?>\"/>\n\t\t\t<p class=\"description\"><?php _e( 'Numero VAT', 'rcp' ); ?></p>\n\t\t</td>\n\t</tr>\n\t<?php\n}", "abstract function setCustomFields();", "function AddCustomFieldInfo($subscriber_email=false, $customfields=array())\n\t{\n\t\tif (!$subscriber_email) {\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t* in case somehow the email addresses have a space before them (or after)\n\t\t* when they are stored in the system, trim it down.\n\t\t* otherwise we end up with a very hard to track down bug where custom fields/links\n\t\t* are not replaced - because the _recipientscustomfields array has a space before the address\n\t\t* but the base address doesn't have it.\n\t\t*/\n\t\t$this->_RecipientsCustomFields[trim($subscriber_email)] = $customfields;\n\t}", "function add_vendor_custom_fields() {\n\n\twp_nonce_field( basename( __FILE__ ), 'vendor_custom_fields_nonce' );\n\t?>\n\n\t<div class=\"form-field\">\n\t\t<label for=\"facebook\"><?php _e( 'Facebook', 'domain' ); ?></label>\n\t\t<input type=\"url\" name=\"facebook\" id=\"facebook\" value=\"\" />\n\t</div>\n\n\t<div class=\"form-field\">\n\t\t<label for=\"twitter\"><?php _e( 'Twitter', 'domain' ); ?></label>\n\t\t<input type=\"url\" name=\"twitter\" id=\"twitter\" value=\"\" />\n\t</div>\n\t<?php\n}", "function af_rcp_add_user_fields() {\n\n\t$cif = get_user_meta( get_current_user_id(), 'rcp_cif', true );\t\n\t$codpost = get_user_meta( get_current_user_id(), 'rcp_codpost', true );\n\t$direccion = get_user_meta( get_current_user_id(), 'rcp_direccion', true );\n\t$ciudad = get_user_meta( get_current_user_id(), 'rcp_ciudad', true );\n\t$vatnumber = get_user_meta( get_current_user_id(), 'rcp_vatnumber', true );\n\n\n\t?>\n\t<p>\n\t\t<label for=\"rcp_cif\"><?php _e( 'DNI / CIF', 'rcp' ); ?></label>\n\t\t<input name=\"rcp_cif\" id=\"rcp_cif\" type=\"text\" value=\"<?php echo esc_attr( $cif ); ?>\"/>\n\t</p>\n\n\t<p>\n\t\t<label for=\"rcp_codpost\"><?php _e( 'CÓDIGO POSTAL', 'rcp' ); ?></label>\n\t\t<input name=\"rcp_codpost\" id=\"rcp_codpost\" type=\"text\" value=\"<?php echo esc_attr( $codpost ); ?>\"/>\n\t</p>\n\n\t<p>\n\t\t<label for=\"rcp_ciudad\"><?php _e( 'CIUDAD', 'rcp' ); ?></label>\n\t\t<input name=\"rcp_ciudad\" id=\"rcp_ciudad\" type=\"text\" value=\"<?php echo esc_attr( $ciudad ); ?>\"/>\n\t</p>\n\n\t<p>\n\t\t<label for=\"rcp_direccion\"><?php _e( 'DIRECCIÓN', 'rcp' ); ?></label>\n\t\t<input name=\"rcp_direccion\" id=\"rcp_direccion\" type=\"text\" value=\"<?php echo esc_attr( $direccion ); ?>\"/>\n\t</p>\n\n\t<p>\n\t\t<label for=\"rcp_vatnumber\"><?php _e( 'NÚMERO VAT (opcional, Si dispones de numero intracomunitario ponlo aquí)', 'rcp' ); ?></label>\n\t\t<input name=\"rcp_vatnumber\" id=\"rcp_vatnumber\" type=\"text\" value=\"<?php echo esc_attr( $vatnumber ); ?>\"/>\n\t</p>\n\t<?php\n}", "public function customfieldsAction()\n {\n $translatedFields = array();\n $customFields = Service_Contact::GetColumns();\n foreach ($customFields as $customField => $trads) {\n $isAlwaysSearchable = in_array($customField, array(\"lastName\", \"mobile\"));\n $searchable = in_array($customField, array(\"firstName\", \"lastName\", \"mobile\"));\n $isActive = in_array($customField, array(\"lastName\", \"mobile\"));\n $translatedFields[] = array(\n \"customField\" => $customField,\n \"translation\" => $trads,\n \"isActive\" => $isActive,\n \"value\" => \"\",\n \"type\" => \"text\",\n \"maxLength\" => \"\",\n \"searchable\" => $searchable,\n \"isAlwaysSearchable\" => $isAlwaysSearchable\n );\n }\n\n // Add personnal fields to custom fields\n $connectedUser = Dm_Session::GetEntry(Dm_Session::CONNECTED_USER);\n $personnalFields = $connectedUser->getParameterValue('personnalFieldsForSmsNotif');\n $return = array_merge($translatedFields, (array) json_decode($personnalFields, true));\n $this->_helper->json($return);\n }", "function add_product_fields()\n {\n $meta_box = new TTC_Product_Fields();\n $meta_box->register();\n }", "public function payment_fields() {\r\n\r\n\r\n\t\t}", "public function testUpdateOrderLineCustomFields()\n {\n }", "public function save_vendor_dashboard_custom_pdf_fields( $store_id ) {\n if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['_wpnonce'] ), 'dokan_store_settings_nonce' ) ) {\n return;\n }\n\n if ( ! dokan_is_user_seller( $store_id ) ) {\n return;\n }\n // check if user choose to override invoice number\n $override_invoice_num = isset( $_POST['dokan_wcpdf_documents_settings_invoice']['override_invoice_num'] ) ? absint( wp_unslash( $_POST['dokan_wcpdf_documents_settings_invoice']['override_invoice_num'] ) ) : 0;\n if ( $override_invoice_num ) {\n $invoice_settings = [\n 'override_invoice_num' => $override_invoice_num,\n 'invoice_number' => isset( $_POST['dokan_wcpdf_documents_settings_invoice']['invoice_number'] ) ? absint( wp_unslash( $_POST['dokan_wcpdf_documents_settings_invoice']['invoice_number'] ) ) : 1,\n 'number_format_prefix' => isset( $_POST['dokan_wcpdf_documents_settings_invoice']['number_format']['prefix'] ) ? sanitize_text_field( wp_unslash( $_POST['dokan_wcpdf_documents_settings_invoice']['number_format']['prefix'] ) ) : '',\n 'number_format_suffix' => isset( $_POST['dokan_wcpdf_documents_settings_invoice']['number_format']['suffix'] ) ? sanitize_text_field( wp_unslash( $_POST['dokan_wcpdf_documents_settings_invoice']['number_format']['suffix'] ) ) : '',\n 'number_format_padding' => isset( $_POST['dokan_wcpdf_documents_settings_invoice']['number_format']['padding'] ) ? absint( wp_unslash( $_POST['dokan_wcpdf_documents_settings_invoice']['number_format']['padding'] ) ) : 0,\n 'reset_number_yearly' => isset( $_POST['dokan_wcpdf_documents_settings_invoice']['reset_number_yearly'] ) ? absint( wp_unslash( $_POST['dokan_wcpdf_documents_settings_invoice']['reset_number_yearly'] ) ) : 0,\n ];\n } else {\n $invoice_settings = get_user_meta( $store_id, 'dokan_wcpdf_documents_settings_invoice', true );\n $invoice_settings['override_invoice_num'] = $override_invoice_num;\n }\n // store settings\n update_user_meta( $store_id, 'dokan_wcpdf_documents_settings_invoice', $invoice_settings );\n }", "function hr_custom_contact_info( $fields ) {\n \n $fields = array_splice($fields, 0, 0) + ['organization'=>'Organization'] + $fields;\n\n // Return the amended contact fields.\n return $fields;\n \n}", "public function add_custom_fields( $fields ) {\n // Website field\n $fields['billing']['billing_website'] = array(\n 'label' => __( 'Website', LMD_SLUG ),\n 'placeholder' => _x( 'Website', 'placeholder', LMD_SLUG ),\n 'required' => true,\n 'class' => ['form-row-wide'],\n 'clear' => true\n );\n\n // Username field\n $fields['billing']['billing_username'] = array(\n 'label' => __( 'Username', LMD_SLUG ),\n 'placeholder' => _x( 'Username', 'placeholder', LMD_SLUG ),\n 'required' => true,\n 'class' => ['form-row-wide'],\n 'clear' => true\n );\n\n return $fields;\n }", "public function set_additional_info($field_name, $field_value)\n {\n $max_length = self::LENGTH_TWENTY_FIVE;\n $field_id = '';\n $function = NULL;\n switch ($field_name)\n {\n case parent::ID_ADDITIONAL_DATA_BILL_NUMBER:\n case parent::ID_ADDITIONAL_DATA_BILL_NUMBER_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_BILL_NUMBER;\n break;\n case parent::ID_ADDITIONAL_DATA_MOBILE_NUMBER:\n case parent::ID_ADDITIONAL_DATA_MOBILE_NUMBER_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_MOBILE_NUMBER;\n break;\n case parent::ID_ADDITIONAL_DATA_STORE_LABEL:\n case parent::ID_ADDITIONAL_DATA_STORE_LABEL_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_STORE_LABEL;\n break;\n case parent::ID_ADDITIONAL_DATA_LOYALTY_NUMBER:\n case parent::ID_ADDITIONAL_DATA_LOYALTY_NUMBER_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_LOYALTY_NUMBER;\n break;\n case parent::ID_ADDITIONAL_DATA_REFERENCE_LABEL:\n case parent::ID_ADDITIONAL_DATA_REFERENCE_LABEL_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_REFERENCE_LABEL;\n break;\n case parent::ID_ADDITIONAL_DATA_CUSTOMER_LABEL:\n case parent::ID_ADDITIONAL_DATA_CUSTOMER_LABEL_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_CUSTOMER_LABEL;\n break;\n case parent::ID_ADDITIONAL_DATA_TERMINAL_LABEL:\n case parent::ID_ADDITIONAL_DATA_TERMINAL_LABEL_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_TERMINAL_LABEL;\n break;\n case parent::ID_ADDITIONAL_DATA_PURPOSE_OF_TRANSACTION:\n case parent::ID_ADDITIONAL_DATA_PURPOSE_OF_TRANSACTION_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_PURPOSE_OF_TRANSACTION;\n break;\n case parent::ID_ADDITIONAL_DATA_ADDITIONAL_CUSTOMER_DATA_REQUEST:\n case parent::ID_ADDITIONAL_DATA_ADDITIONAL_CUSTOMER_DATA_REQUEST_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_ADDITIONAL_CUSTOMER_DATA_REQUEST;\n $function = parent::ID_ADDITIONAL_DATA_ADDITIONAL_CUSTOMER_DATA_REQUEST_KEY;\n break;\n case parent::ID_ADDITIONAL_DATA_MERCHANT_TAX_ID:\n case parent::ID_ADDITIONAL_DATA_MERCHANT_TAX_ID_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_MERCHANT_TAX_ID;\n $max_length = parent::LENGTH_TWENTY;\n break;\n case parent::ID_ADDITIONAL_DATA_MERCHANT_CHANNEL:\n case parent::ID_ADDITIONAL_DATA_MERCHANT_CHANNEL_KEY:\n $field_id = parent::ID_ADDITIONAL_DATA_MERCHANT_CHANNEL;\n $function = parent::ID_ADDITIONAL_DATA_MERCHANT_CHANNEL_KEY;\n break;\n default:\n return $this->return_status(FALSE, self::STATUS_INVALID_FIELD_ID, parent::ID_ADDITIONAL_DATA_FIELDS);\n }\n if (is_null($function))\n {\n if ($this->validate_ans_charset_len($field_value, $max_length))\n {\n $this->additional_fields[$field_id] = $field_id . sprintf('%02d', strlen($field_value)) . $field_value;\n return $this->return_status(TRUE);\n }\n } else if ($function == parent::ID_ADDITIONAL_DATA_ADDITIONAL_CUSTOMER_DATA_REQUEST_KEY)\n {\n if (preg_match('/^[A|M|E]{1,3}$/', $field_value))\n {\n $this->additional_fields[$field_id] = $field_id . sprintf('%02d', strlen($field_value)) . $field_value;\n return $this->return_status(TRUE);\n }\n } else if ($function == parent::ID_ADDITIONAL_DATA_MERCHANT_CHANNEL_KEY)\n {\n if (preg_match('/^[0-7][0-3][0-3]$/', $field_value))\n {\n $this->additional_fields[$field_id] = $field_id . sprintf('%02d', strlen($field_value)) . $field_value;\n return $this->return_status(TRUE);\n }\n }\n return $this->return_status(FALSE, self::STATUS_INVALID_VALUE, parent::ID_ADDITIONAL_DATA_FIELDS . '.' . $field_name);\n }", "function plugin_version_customfields() {\n global $LANG;\n return array('name' => $LANG['plugin_customfields']['title'],\n 'author' => 'Oregon State Data Center, Nelly Mahu Lasson',\n 'license' => 'GPLv2+',\n 'homepage' => 'https://forge.indepnet.net/projects/show/customfields',\n 'minGlpiVersion' => '0.83.3',\n 'version' => '1.4.1');\n}", "function add_customer_invoice_column($columns) {\n\t\treturn array_merge( $columns, \n \tarray('_total_invoice' => __('Total Invoice','dxinvoice'),\n \t '_total_invoice_amount' => __('Total Invoice Amount','dxinvoice'),\n \t '_total_invoice_unpaid' => __('Total Invoice Unpaid','dxinvoice')));\n\t}", "public function creating(Invoice $invoice)\n {\n $invoice->code = $this->generateInvoiceNumber($invoice);\n }", "function pixel_bazaarinvoice() {\n\t\tglobal $post;\n\t\t$custom = get_post_meta($post->ID,'jht_specs');\n\t\t$jht_specs = $custom[0];\n\t\t$prod = esc_attr($jht_specs['product_id']);\n\t\t$val = get_post_meta( $post->ID, 'lead-type', true );\n\t\tif ( !empty( $prod ) ) { ?>\n\t\t\t<script type=\"text/javascript\"> \n\t\t\t$BV.configure(\"global\", { productId : \"<?php echo $prod; ?>\" });\n\t\t\t</script>\n\t\t<?php }\n\t\tif ( !empty( $val ) ) { ?>\n\t\t\t<script>\n\t\t\t$BV.SI.trackConversion({\n\t\t\t\"type\" : \"lead-<?php echo $val; ?>\",\n\t\t\t\"value\" : \"<?php echo $val; ?>\"\n\t\t\t});\n\t\t\t</script>\n\t\t<?php }\n\t}", "protected function addPersonalFields(): void\n {\n /** @var Schema $this */\n $this->addField('firstName')\n ->setFieldLabel('First Name')\n ->isRequired();\n\n $this->addField('lastName')\n ->setFieldLabel('Last Name')\n ->isRequired();\n\n $this->addField('username')\n ->setFieldLabel('Username')\n ->setFieldPlaceholder('Username')\n ->setFieldInvalidFeedback('Your username is required.')\n ->isRequired();\n\n $this->addField('email', ['type' => 'email'])\n ->setFieldLabel('Last Name', '(Optional)')\n ->setFieldPlaceholder('[email protected]')\n ->setFieldInvalidFeedback('Please enter a valid email address for shipping updates.');\n }", "function add_new_checkout_fields( $fields ) {\n\t\t$fields['shipping']['shipping_phone'] = array(\n\t\t\t'label' => __('Phone', 'woocommerce'),\n\t\t\t'placeholder' => _x('Phone', 'placeholder', 'woocommerce'),\n\t\t\t'required' => false,\n\t\t\t'class' => array('form-row-wide'),\n\t\t\t'clear' => true\n\t\t);\n\n\t\treturn $fields;\n}", "abstract protected function get_custom_fields();", "public function generateInvoiceNumber();", "function pilau_register_custom_fields() {\n\tif ( class_exists( 'Codepress_Admin_Columns' ) )\n\t\tadd_filter( 'cpac_use_hidden_custom_fields', '__return_true' );\n\n\t/*\n\tslt_cf_register_box( array(\n\t\t'type'\t\t=> 'post',\n\t\t'title'\t\t=> 'Sample custom field',\n\t\t'id'\t\t=> 'sample',\n\t\t'context'\t=> 'advanced',\n\t\t'fields'\t=> array(\n\t\t\tarray(\n\t\t\t\t'name'\t\t\t=> 'sample',\n\t\t\t\t'label'\t\t\t=> 'Sample',\n\t\t\t\t'description'\t=> 'Some hints for the user.',\n\t\t\t\t'type'\t\t\t=> 'text',\n\t\t\t\t'scope'\t\t\t=>\tarray( 'post', 'page' ),\n\t\t\t\t'capabilities'\t=> array( 'edit_posts', 'edit_pages' )\n\t\t\t)\n\t\t)\n\t));\n\t*/\n\n}", "function template_preprocess_commerce_invoice_number(array &$variables) {\n if (!empty($variables['invoice_number'])\n && $variables['invoice_number'] instanceof InvoiceNumber) {\n /** @var InvoiceNumber $number */\n $number = $variables['invoice_number'];\n $variables['key'] = $number->getKey();\n $variables['pattern_name'] = $number->getPatternName();\n if ($number->pattern->skip_sequence) {\n $variables['sequence'] = '';\n }\n else {\n $variables['sequence'] = $number->getSequence();\n }\n }\n}" ]
[ "0.65183395", "0.64912915", "0.6442009", "0.63526756", "0.6297251", "0.6285866", "0.6260297", "0.6218321", "0.6216425", "0.6153347", "0.6125414", "0.6122971", "0.61208886", "0.61029583", "0.60870403", "0.60825706", "0.6069137", "0.59414357", "0.5915725", "0.5854206", "0.5849163", "0.58348817", "0.5828726", "0.5810106", "0.57941586", "0.57867265", "0.57834905", "0.5779372", "0.57690316", "0.57672983" ]
0.68526137
0
test validateMove() Also checkBoardBoundary()
public function testValidMove() { $firstPawn = new Pawn(PieceColorEnum::BLACK()); $this->_testSubject->getBoard()->add($firstPawn, 6, 3); $test = $this->_testSubject->validateMove($firstPawn, 8, 2); $this->assertFalse($test); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_bounds($i, $moves, $move_result, $grid_size, $facing, $cmd_debug, $movement_commands){\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] *** check_bounds()<br />\";\n $cmd_debug .= \"[\".$i.\"] *** \".$moves[$i-1][0].\" < 0 | \".$move_result[0].\" >= \".$grid_size.\" | \".$move_result[1].\" < 0 | \".$move_result[1].\" >= \".$grid_size.\"<br />\";\n\n if($moves[$i-1][0] < 0 | $move_result[0] >= $grid_size | $move_result[1] < 0 | $move_result[1] >= $grid_size | $move_result[0] < 0){\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] ** Test Fail @ check_bounds() test A<br />\";\n\n }elseif($moves[$i][0] == '' && $moves[$i-1][0] == 0){\n $move_validity = true;\n $cmd_debug .= \"[\".$i.\"] ** Test Pass @ check_bounds() A<br />\";\n }else{\n if ($facing==='south' && $moves[$i-1][1]==0 && $movement_commands[$i]!='report') {\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] ** Test Fail @ check_bounds() test C<br />\";\n\n }elseif ($facing==='west' && $move_result[0] < 0) {\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] ** Test Fail @ check_bounds() test D<br />\";\n }else{\n $move_validity = true;\n $cmd_debug .= \"[\".$i.\"] ** Test Pass @ check_bounds() B<br />\";\n }\n }\n if($move_validity){\n $cmd_debug .= \"[\".$i.\"] ** Valid Move **<br />\";\n }else{\n $cmd_debug .= \"[\".$i.\"] ** Invalid Move **<br />\";\n \n }\n return array($move_validity, $cmd_debug);\n}", "public function testValidMove_Not_Same_Cell()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $test = $this->_testSubject->validateMove($firstPawn, 6, 3);\n $this->assertFalse($test);\n }", "private function move() {\n\n \n switch ($this->direction) {\n case 'N':\n if($this->address['row'] == $this->block['col']){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['row'] ++; // add rows on move to north\n break;\n case 'E':\n if($this->address['col'] == $this->block['col']){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['col'] ++; // add cols on move to east\n break;\n case 'S':\n if($this->address['row'] == 0){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['row'] --; // deduct rows on move to south\n break;\n case 'W':\n if($this->address['col'] == 0){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['col'] --; // deduct rows on move to west\n break;\n }\n\n\n return true;\n\n }", "public function testValidMove_Piece_Move_IllegalCoordinates_Left_DoesNotMove()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $test = $this->_testSubject->validateMove($firstPawn, 4, 3);\n $this->assertFalse($test);\n }", "public function testValidMove_Piece_Move_OccupiedBySameColor()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $firstRook = new Rook(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $this->_testSubject->getBoard()->add($firstRook, 6, 2);\n $test = $this->_testSubject->validateMove($firstPawn, 6, 2);\n $this->assertFalse($test);\n }", "public function testBestMoveForWinnableStatusShouldReturnWinnableMoveCoordinates()\n {\n $bot = new Bot();\n\n $this->assertEquals([2, 0], $bot->makeMove([\n ['X', 'X', ''],\n ['O', 'X', 'X'],\n ['', 'O', 'O'],\n ], 'O'));\n }", "public function testMakeMove_Piece_Move_LegalCoordinates_Forward_DoesMove()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 5, 3);\n $this->_testSubject->makeMove($firstPawn, 5, 2);\n $this->assertEquals(2, $firstPawn->getYCoordinate());\n }", "public function can_move_based_on_movable_position()\n {\n $testPos = ['x' => 0, 'y' => 1, 'face' => 'NORTH'];\n $this->robot->setCurrentPosition($testPos);\n \n $newPos = $this->robot->canMove();\n $expectPos = ['x'=>0, 'y' => 2, 'face' => 'NORTH'];\n $this->assertEquals($expectPos, $newPos);\n }", "public function testBestMoveForDefendingStatusShouldReturnDefendingMoveCoordinates()\n {\n $bot = new Bot();\n\n $this->assertEquals([2, 2], $bot->makeMove([\n ['X', '', 'O'],\n ['O', 'X', ''],\n ['X', '', ''],\n ], 'O'));\n }", "function suggest_moves($border, $value, $grid_size) {\n if(($value < $grid_size-1) && ($value > 0)){\n $alt_move_opts = \"left, right\";\n }else{\n switch ($border) {\n case 'north':\n case 'west':\n if($value==$grid_size-1){\n $alt_move_opts = \"left\";\n }elseif($value==0){\n $alt_move_opts = \"right\";\n }\n break;\n\n case 'south':\n case 'east':\n if($value==$grid_size-1){\n $alt_move_opts = \"right\";\n }elseif($value==0){\n $alt_move_opts = \"left\";\n }\n break;\n\n default:\n # code...\n break;\n }\n } \n $alt_move = \"Available moves: \".$alt_move_opts;\n $cmd_debug = \"<br />[error] Hitting the \".$border.\" border<br />alternate: \".$alt_move;\n $err_output = \"<br />Robot crossed the \".$border.\" edge.<br />\"; //.$alt_move;\n\n return array($alt_move, $cmd_debug, $err_output);\n}", "private function isValidMove($id) {\n if ($id==$this->pos) {\n return false;\n }\n if ($id+$this->size==$this->pos) {\n return true;\n }\n if ($id-$this->size==$this->pos) {\n return true;\n }\n if ($id+1==$this->pos && ($id+1)%4!=0) {\n return true;\n }\n if ($id-1==$this->pos && ($id-1)%4!=3) {\n return true;\n }\n return false;\n }", "private function testTwo(){\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,4),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell up\");\r\n\t\t\r\n\t\t//2 cell snake going down\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,6),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell down\");\r\n\t\t\r\n\t\t//4 cell snake going up\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,2),\r\n\t\t\t$this->getCoordinateObj(5,3),\r\n\t\t\t$this->getCoordinateObj(5,4),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell up\");\r\n\t\t\r\n\t\t//4 cell snake going down\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,8),\r\n\t\t\t$this->getCoordinateObj(5,7),\r\n\t\t\t$this->getCoordinateObj(5,6),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell down\");\r\n\t}", "public function validate(array $board, int $player, array $from, array $to)\n {\n if ($board[$from[0]][$from[1]][1] !== $player) {\n throw new InvalidMoveException('You must choose a piece that belongs to you.');\n }\n }", "public function can_not_move_based_on_unmovable_position()\n {\n $testPos = ['x' => 0, 'y' => 5, 'face' => 'NORTH'];\n $this->robot->setCurrentPosition($testPos);\n \n $canMove = $this->robot->canMove();\n $this->assertEquals(false, $canMove);\n $this->assertEquals($testPos, $this->robot->getCurrentPosition()); // current position remain unchanged\n }", "public function validateMove( $gameUnitUID, $targetX, $targetY, $userUID ){\n\n\t\t//Grab the gameUnit \n\t\t$gameUnitModelInstance \t= ClassRegistry::init( 'GameUnit' );\n\t\t$gameUnit \t\t\t\t= $gameUnitModelInstance->findForMoveValidation( $gameUnitUID );\n\t\t\n\t\t//The gameUnit find will return false if there's another unit in this game that\n\t\t//is currently selected.\n\t\tif( $gameUnit == false ){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t//Make sure the unit has a user game that belongs to the user and that the game \n\t\t//and the game unit are on the same turn\n\t\tif( $gameUnit['GameUnit']['users_uid'] != $userUID ){\n\t\t\treturn false;\n\t\t}\n\t\t\t\t\n\t\t//Make sure the given user is the active user for the current game\n\t\t$activeUserModelInstance = ClassRegistry::init( 'ActiveUser' );\n\t\t$activePlayer = $activeUserModelInstance->findActiveUser( $gameUnit['Game']['uid'], $gameUnit['Game']['turn'] );\n\t\tif( ! isset( $activePlayer ) or $activePlayer['UserGame']['users_uid'] != $userUID ){\n\t\t\treturn false;\n\t\t}\n\t\t\t\t\n\t\t//Get the new priority for this unit\n\t\t$movePriority = $gameUnit['GameUnit']['last_movement_priority'];\n\t\t\n\t\t//Grab the staring positions and last move angle\n\t\t$startX \t = $gameUnit['GameUnit']['x'];\n\t\t$startY \t = $gameUnit['GameUnit']['y'];\n\t\t$lastAngle\t = $gameUnit['GameUnit']['last_movement_angle'];\n\t\t$gameUID \t = $gameUnit['Game']['uid'];\n\t\t\n\t\t\n\t\t//Grab an array of the possible movements\n\t\tif( $movePriority == 0 ){\n\t\t\t\n\t\t\t$gameUnitMovementSets = $gameUnitModelInstance->findAllMovementSetsWithPriority( $gameUnitUID, $movePriority );\n\t\t\t\n\t\t}else{\n\n\t\t\t//Setup a MovementSet instance to grab this one set\n\t\t\t$movementSetModelInstance = ClassRegistry::init( 'MovementSet' );\n\t\t\t$gameUnitMovementSets = [\n [\n 'MovementSet' => array_merge(\n [ 'uid' => $gameUnit['GameUnit']['movement_sets_uid'] ],\n $movementSetModelInstance->findByUIDWithPriority( $gameUnit['GameUnit']['movement_sets_uid'], $movePriority )\n )\n ]\n ];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\t//See if any of the possible movements can get the unit to the target\n\t\tforeach( $gameUnitMovementSets as $movementSets ){\n\t\t\tforeach( $movementSets['MovementSet']['Movement'] as $movement ){\n\t\t\n\t\t\t\t//Grab the spaces this move can travel along with whether it\n\t\t\t\t//must travel them all or only some\n\t\t\t\t$spaces\t\t\t\t= intval( $movement['spaces'] );\n\t\t\t\t$mustMoveAllTheWay\t= intval( $movement['must_move_all_the_way'] );\n\t\t\t\t\t\t\t\t\n\t\t\t\t//Loop through all the movement direction sets and direction sets\n\t\t\t\tforeach( $movement['MovementDirectionSet'] as $movementDirectionSet ){\n\t\t\t\t\tforeach( $movementDirectionSet['DirectionSet']['DirectionSetDirection'] as $directionSetDirection ){\n\t\t\t\t\t\n\t\t\t\t\t\t//Grab the direction\n\t\t\t\t\t\t$direction = $directionSetDirection['Direction'];\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Get the angle \n\t\t\t\t\t\t$angleToCheck = $direction['angle'] + $lastAngle;\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Grab the x and y direction we'll be checking\n\t\t\t\t\t\t$xDirection = intval( round( sin( $angleToCheck * ( pi() / 180 ) ) ) );\n\t\t\t\t\t\t$yDirection = - intval( round( cos( $angleToCheck * ( pi() / 180 ) ) ) );\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Check if the unit has to move all the way\t\t\t\t\t\t\n\t\t\t\t\t\tif( $mustMoveAllTheWay ){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//Find the x and y to check and if they're successful then we can return true\n\t\t\t\t\t\t\t$xToCheck = $startX + ( $spaces * $xDirection );\n\t\t\t\t\t\t\t$yToCheck = $startY + ( $spaces * $yDirection );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//If we have a match, update the game and then return true\n\t\t\t\t\t\t\tif( $xToCheck == $targetX and $yToCheck == $targetY ){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t$this->updateGame( \n\t\t\t\t\t\t\t\t\t$gameUID,\n\t\t\t\t\t\t\t\t\t$gameUnit['GameUnit']['turn'],\n\t\t\t\t\t\t\t\t\t$gameUnitUID,\n\t\t\t\t\t\t\t\t\t$targetX,\n\t\t\t\t\t\t\t\t\t$targetY,\n\t\t\t\t\t\t\t\t\t$angleToCheck,\n\t\t\t\t\t\t\t\t\t$movePriority,\n\t\t\t\t\t\t\t\t\t$movementSets['MovementSet']['uid']\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t}else{\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t//Check the x and y of each space we move along\n\t\t\t\t\t\t\tfor( $spaceCounter = 1; $spaceCounter <= $spaces; $spaceCounter++ ){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t$xToCheck = $startX + ( $spaceCounter * $xDirection );\n\t\t\t\t\t\t\t\t$yToCheck = $startY + ( $spaceCounter * $yDirection );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t//If we have a match, update the game and then return true\n\t\t\t\t\t\t\t\tif( $xToCheck == $targetX and $yToCheck == $targetY ){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$this->updateGame( \n\t\t\t\t\t\t\t\t\t\t$gameUID, \n\t\t\t\t\t\t\t\t\t\t$gameUnit['GameUnit']['turn'], \n\t\t\t\t\t\t\t\t\t\t$gameUnitUID, \n\t\t\t\t\t\t\t\t\t\t$targetX, \n\t\t\t\t\t\t\t\t\t\t$targetY,\n $angleToCheck,\n\t\t\t\t\t\t\t\t\t\t$movePriority,\n\t\t\t\t\t\t\t\t\t\t$movementSets['MovementSet']['uid']\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t}\t\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\t//If we found no match we return false because we couldn't validate the move\n\t\treturn false;\n\n\t}", "public function testMakeTwoMoves()\r\n {\r\n $this->game->makeMove(0, 0, 'X');\r\n $this->game->makeMove(0, 1, 'O');\r\n\r\n $cell = $this->game->board->getPositionContent(0,0);\r\n $this->assertEquals($cell, 'X');\r\n\r\n $cell = $this->game->board->getPositionContent(0,1);\r\n $this->assertEquals($cell, 'O');\r\n\r\n }", "private function checkDraw() {\n return $this->movesTaken == SIZE * SIZE;\n }", "function canMove()\n {\n return $this->canMoveFrom();\n }", "public function processTurnToNotWin()\n {\n $game = MockFactory::getGameMock();\n $aiBattlefield = $game->getBattlefields()[0];\n $aiBattlefield->setPlayer(MockFactory::getAIPlayerMock(''));\n\n foreach ($game->getBattlefields() as $battlefield) {\n $battlefield->getCellByCoordinate('A1')->addFlag(CellModel::FLAG_SHIP);\n $battlefield->getCellByCoordinate('A2')->addFlag(CellModel::FLAG_SHIP);\n }\n\n $game = static::$gameProcessor->processTurn($aiBattlefield->getCellByCoordinate('A1'));\n\n foreach ($game->getBattlefields() as $battlefield) {\n $this->assertCount(48, BattlefieldModel::getLiveCells($battlefield));\n /** as one cell should be dead */\n $this->assertTrue(BattlefieldModel::hasUnfinishedShips($battlefield));\n }\n\n $this->assertTrue($aiBattlefield->getCellByCoordinate('A1')->hasFlag(CellModel::FLAG_DEAD_SHIP));\n $this->assertNull($game->getResult());\n }", "public function canMoveSomewhere(): bool\n {\n $moves = [\n ['x' => $this->pos['x'] - 1, 'y' => $this->pos['y'] - 1],\n ['x' => $this->pos['x'] - 1, 'y' => $this->pos['y']],\n ['x' => $this->pos['x'] - 1, 'y' => $this->pos['y'] + 1],\n ['x' => $this->pos['x'], 'y' => $this->pos['y'] + 1],\n ['x' => $this->pos['x'] + 1, 'y' => $this->pos['y'] + 1],\n ['x' => $this->pos['x'] + 1, 'y' => $this->pos['y']],\n ['x' => $this->pos['x'] + 1, 'y' => $this->pos['y'] - 1],\n ['x' => $this->pos['x'], 'y' => $this->pos['y'] - 1],\n ];\n\n return $this->canAnyByMoves($moves);\n }", "public function g_move_onto_board_set_D (Player $x_player) \n{\n \n $x_piece_pointer = $this->g_find_to_move_onto_board($x_player);\n\n if($x_piece_pointer == 0) \n {\n\n //no more pieces to move on to the board\n $this->g_logmove( \"<font color=orange>Player \" . $x_player->p_get_playerid() . \" did not have pieces off the board to move into play.</font>\");\n \n return FALSE;\n \n }\n \n else\n \n {\n\n $this->g_marker_move($x_player, $x_piece_pointer);\n\n return TRUE;\n } \n}", "public function testMakeMove_Piece_Move_OccupiedByDifferentColor()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $firstRook = new Rook(PieceColorEnum::WHITE());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $this->_testSubject->getBoard()->add($firstRook, 6, 2);\n $this->_testSubject->makeMove($firstPawn, 6, 2);\n $this->assertEquals(2, $firstPawn->getYCoordinate());\n }", "private function testOne(){\r\n\t\t$this->obj->you->body = [$this->getCoordinateObj(5,5)];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down,\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"one-cell snake\");\r\n\t}", "public function validate()\n {\n $this->validateDuplicateCoordinates();\n $this->validateWrongBorder();\n $this->validate_coordinate_order();\n $this->validate_number_of_descendants();\n }", "function checkWinConditions($move){\n\t\t$winningCombinations = array(\"-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\");\n\t\t$winner = \"none\";\n\t\t$winningCombinations[0] = $move[0].$move[1].$move[2];\n\t\t$winningCombinations[1] = $move[0].$move[4].$move[8];\n\t\t$winningCombinations[2] = $move[0].$move[3].$move[6];\n\t\t$winningCombinations[3] = $move[1].$move[4].$move[7];\n\t\t$winningCombinations[4] = $move[2].$move[5].$move[8];\n\t\t$winningCombinations[5] = $move[2].$move[4].$move[6];\n\t\t$winningCombinations[6] = $move[3].$move[4].$move[5];\n\t\t$winningCombinations[7] = $move[6].$move[7].$move[8];\n\t\tforeach($winningCombinations as $wincondition){\n\t\t\tif($wincondition==\"xxx\"){\n\t\t\t\t$winner = \"xwins\";\n\t\t\t\t// incrementSessionCounter(\"xwins\");\n\t\t\t\treturn $winner;\n\t\t\t}\n\t\t\telseif($wincondition==\"ooo\"){\n\t\t\t\t$winner = \"owins\";\n\t\t\t\t// incrementSes÷sionCounter(\"owins\");\n\t\t\t\treturn $winner;\n\t\t\t}\n\t\t}\n\t}", "public function canMove(): bool\n {\n return count($this->visitedCoordinates) < $this->matrix->getSize();\n }", "private function validateMoveOrTurn(Request $request) : bool\n {\n $validator = Validator::make($request->all(), [\n 'x' => 'required|string',\n 'y' => 'required|integer|min:1|max:5',\n 'dir' => 'required|string'\n ]);\n\n if ($validator->fails() || !in_array($request->get('x'), config('mario.nodes'))) {\n return false;\n }\n\n return true;\n }", "private function testThree(){\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(4,5),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell left\");\r\n\t\t\r\n\t\t//2 cell snake going right\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(6,5),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell right\");\r\n\t\t\r\n\t\t//4 cell snake going left\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(2,5),\r\n\t\t\t$this->getCoordinateObj(3,5),\r\n\t\t\t$this->getCoordinateObj(4,5),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell left\");\r\n\t\t\r\n\t\t//4 cell snake going right\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(8,5),\r\n\t\t\t$this->getCoordinateObj(7,5),\r\n\t\t\t$this->getCoordinateObj(6,5),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell right\");\r\n\t}", "public function testValidateCoordNok2()\n {\n $res = $this->ipObj->validateCoord('127.0.0.1');\n $this->assertFalse($res);\n }", "public function checkForWin()\n {\n $winConditions = [\n // rows\n [0,1,2],\n [3,4,5],\n [6,7,8],\n // cols\n [0,3,6],\n [1,4,7],\n [2,5,8],\n // diagonals\n [0,4,8],\n [2,4,6]\n ];\n\n foreach ($winConditions as $wc) {\n if ($this->areEquals([$this->board[$wc[0]], $this->board[$wc[1]], $this->board[$wc[2]]])) {\n return true;\n }\n }\n\n return false;\n }" ]
[ "0.7332908", "0.71360004", "0.697938", "0.68307376", "0.6814896", "0.66612905", "0.65525424", "0.63019675", "0.61920816", "0.61128914", "0.6070039", "0.6064947", "0.59927934", "0.59489876", "0.5936883", "0.58264893", "0.5818427", "0.581171", "0.5801132", "0.57872456", "0.57342684", "0.5731576", "0.5730862", "0.57280004", "0.5726461", "0.5725355", "0.5706279", "0.5672714", "0.5631321", "0.5593343" ]
0.79557055
0
test validateMove() Also checkNotSameCell()
public function testValidMove_Not_Same_Cell() { $firstPawn = new Pawn(PieceColorEnum::BLACK()); $this->_testSubject->getBoard()->add($firstPawn, 6, 3); $test = $this->_testSubject->validateMove($firstPawn, 6, 3); $this->assertFalse($test); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testValidMove()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $test = $this->_testSubject->validateMove($firstPawn, 8, 2);\n $this->assertFalse($test);\n }", "public function testValidMove_Piece_Move_OccupiedBySameColor()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $firstRook = new Rook(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $this->_testSubject->getBoard()->add($firstRook, 6, 2);\n $test = $this->_testSubject->validateMove($firstPawn, 6, 2);\n $this->assertFalse($test);\n }", "private function move() {\n\n \n switch ($this->direction) {\n case 'N':\n if($this->address['row'] == $this->block['col']){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['row'] ++; // add rows on move to north\n break;\n case 'E':\n if($this->address['col'] == $this->block['col']){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['col'] ++; // add cols on move to east\n break;\n case 'S':\n if($this->address['row'] == 0){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['row'] --; // deduct rows on move to south\n break;\n case 'W':\n if($this->address['col'] == 0){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['col'] --; // deduct rows on move to west\n break;\n }\n\n\n return true;\n\n }", "public function testValidMove_Piece_Move_IllegalCoordinates_Left_DoesNotMove()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $test = $this->_testSubject->validateMove($firstPawn, 4, 3);\n $this->assertFalse($test);\n }", "public function testMakeTwoMoves()\r\n {\r\n $this->game->makeMove(0, 0, 'X');\r\n $this->game->makeMove(0, 1, 'O');\r\n\r\n $cell = $this->game->board->getPositionContent(0,0);\r\n $this->assertEquals($cell, 'X');\r\n\r\n $cell = $this->game->board->getPositionContent(0,1);\r\n $this->assertEquals($cell, 'O');\r\n\r\n }", "public function testMakeMove_Piece_Move_LegalCoordinates_Forward_DoesMove()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 5, 3);\n $this->_testSubject->makeMove($firstPawn, 5, 2);\n $this->assertEquals(2, $firstPawn->getYCoordinate());\n }", "public function can_move_based_on_movable_position()\n {\n $testPos = ['x' => 0, 'y' => 1, 'face' => 'NORTH'];\n $this->robot->setCurrentPosition($testPos);\n \n $newPos = $this->robot->canMove();\n $expectPos = ['x'=>0, 'y' => 2, 'face' => 'NORTH'];\n $this->assertEquals($expectPos, $newPos);\n }", "private function isValidMove($id) {\n if ($id==$this->pos) {\n return false;\n }\n if ($id+$this->size==$this->pos) {\n return true;\n }\n if ($id-$this->size==$this->pos) {\n return true;\n }\n if ($id+1==$this->pos && ($id+1)%4!=0) {\n return true;\n }\n if ($id-1==$this->pos && ($id-1)%4!=3) {\n return true;\n }\n return false;\n }", "private function testTwo(){\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,4),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell up\");\r\n\t\t\r\n\t\t//2 cell snake going down\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,6),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell down\");\r\n\t\t\r\n\t\t//4 cell snake going up\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,2),\r\n\t\t\t$this->getCoordinateObj(5,3),\r\n\t\t\t$this->getCoordinateObj(5,4),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell up\");\r\n\t\t\r\n\t\t//4 cell snake going down\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,8),\r\n\t\t\t$this->getCoordinateObj(5,7),\r\n\t\t\t$this->getCoordinateObj(5,6),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell down\");\r\n\t}", "public function testMakeMove_Piece_Move_OccupiedByDifferentColor()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $firstRook = new Rook(PieceColorEnum::WHITE());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $this->_testSubject->getBoard()->add($firstRook, 6, 2);\n $this->_testSubject->makeMove($firstPawn, 6, 2);\n $this->assertEquals(2, $firstPawn->getYCoordinate());\n }", "function check_bounds($i, $moves, $move_result, $grid_size, $facing, $cmd_debug, $movement_commands){\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] *** check_bounds()<br />\";\n $cmd_debug .= \"[\".$i.\"] *** \".$moves[$i-1][0].\" < 0 | \".$move_result[0].\" >= \".$grid_size.\" | \".$move_result[1].\" < 0 | \".$move_result[1].\" >= \".$grid_size.\"<br />\";\n\n if($moves[$i-1][0] < 0 | $move_result[0] >= $grid_size | $move_result[1] < 0 | $move_result[1] >= $grid_size | $move_result[0] < 0){\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] ** Test Fail @ check_bounds() test A<br />\";\n\n }elseif($moves[$i][0] == '' && $moves[$i-1][0] == 0){\n $move_validity = true;\n $cmd_debug .= \"[\".$i.\"] ** Test Pass @ check_bounds() A<br />\";\n }else{\n if ($facing==='south' && $moves[$i-1][1]==0 && $movement_commands[$i]!='report') {\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] ** Test Fail @ check_bounds() test C<br />\";\n\n }elseif ($facing==='west' && $move_result[0] < 0) {\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] ** Test Fail @ check_bounds() test D<br />\";\n }else{\n $move_validity = true;\n $cmd_debug .= \"[\".$i.\"] ** Test Pass @ check_bounds() B<br />\";\n }\n }\n if($move_validity){\n $cmd_debug .= \"[\".$i.\"] ** Valid Move **<br />\";\n }else{\n $cmd_debug .= \"[\".$i.\"] ** Invalid Move **<br />\";\n \n }\n return array($move_validity, $cmd_debug);\n}", "public function testBestMoveForWinnableStatusShouldReturnWinnableMoveCoordinates()\n {\n $bot = new Bot();\n\n $this->assertEquals([2, 0], $bot->makeMove([\n ['X', 'X', ''],\n ['O', 'X', 'X'],\n ['', 'O', 'O'],\n ], 'O'));\n }", "function callbackTableMove() {\n if ($this->tableMovePos == false) {\n return false;\n }\n \n //print_r(array($w->pointer, $w->pointer_state));\n $w = $this->database->layout->window;\n \n // echo $event->type .\"\\n\";\n $xdiff = $w->pointer[0] - $this->tableMovePos[0];\n $ydiff = $w->pointer[1] - $this->tableMovePos[1];\n //print_r(array($xdiff,$ydiff));\n \n //print_r($event);\n \n \n $this->x = ($this->tableMoveFrameStart->x+ $xdiff);\n $this->y = ($this->tableMoveFrameStart->y+ $ydiff);\n if ($this->x < 0 ) { \n $this->x = 0;\n }\n if ($this->y < 0 ) { \n $this->y = 0;\n }\n \n // grid :)\n $this->x = floor($this->x/10) * 10;\n $this->y = floor($this->y/10) * 10;\n \n $this->database->move($this->frame, $this->x , $this->y);\n \n while (gtk::events_pending()) gtk::main_iteration();\n \n \n return true;\n }", "public function testBestMoveForDefendingStatusShouldReturnDefendingMoveCoordinates()\n {\n $bot = new Bot();\n\n $this->assertEquals([2, 2], $bot->makeMove([\n ['X', '', 'O'],\n ['O', 'X', ''],\n ['X', '', ''],\n ], 'O'));\n }", "function isValid(array $grid): bool\n{\n $indexRow = 0;\n $indexColumn = 0;\n $isValid = true;\n $gridTemp=$grid;\n do\n {\n $val = get($gridTemp, $indexRow, $indexColumn);\n set($gridTemp, $indexRow, $indexColumn, 0);\n $isValid = isValueValidForPosition($gridTemp, $indexRow, $indexColumn, $val);\n set($gridTemp, $indexRow, $indexColumn, $val);\n $tab = getNextRowColumn($gridTemp, $indexRow, $indexColumn);\n $indexRow = $tab[0];\n $indexColumn = $tab[1];\n }\n while(($indexRow != 0 || $indexColumn != 0) && $isValid);\n return $isValid;\n}", "public function can_not_move_based_on_unmovable_position()\n {\n $testPos = ['x' => 0, 'y' => 5, 'face' => 'NORTH'];\n $this->robot->setCurrentPosition($testPos);\n \n $canMove = $this->robot->canMove();\n $this->assertEquals(false, $canMove);\n $this->assertEquals($testPos, $this->robot->getCurrentPosition()); // current position remain unchanged\n }", "public function canMove(): bool\n {\n return count($this->visitedCoordinates) < $this->matrix->getSize();\n }", "public static function testThatMovementsMustBeOfTheSameDimensionality(Vector $badPlace)\n {\n $table = Table::create(5);\n self::assertInstanceOf(Table::class, $table);\n\n // If we just pass one Vector to move() $from\n // is assumed to be origin\n $table->move($badPlace);\n }", "private function checkNeighborhood() {\r\n\r\n for ($y=0; $y < $this->maxRows; $y++) {\r\n for ($x=0; $x < $this->maxCols; $x++) {\r\n \r\n $dot = $this->grid[$y][$x]; //get the `cell value` from the original Grid\r\n\r\n /**\r\n * get how many alive neighbours this `cell` has\r\n */\r\n $getNeighbours = $this->checkNeighbours($y, $x);\r\n\r\n /**\r\n * validate if current `cell` keeps alive, or die, or keeps death\r\n */\r\n $this->cloneGrid[$y][$x] = $this->validateAlive($dot, $getNeighbours);\r\n }\r\n }\r\n }", "public function valid(): bool\n {\n return $this->currentCol != $this->cols || $this->currentRow <= $this->rows;\n }", "private function testOne(){\r\n\t\t$this->obj->you->body = [$this->getCoordinateObj(5,5)];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down,\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"one-cell snake\");\r\n\t}", "public function testMoveNode()\n {\n }", "public function validateCell($cell){\n // Preg Match for Cell Value\n $cell_validity = preg_match('/(^(\\+8801|8801|01|008801))[1|3-9]{1}(\\d){8}$/',$cell) ;\n\n // Checking if the given cell exists in the cell colum\n $id = $_SESSION['logged_user_id'];\n $user = new Users;\n $data = $this->dataExistInColumExcludingId($user->tableName(), 'cell', $cell, $id);\n\n // Conditions for CEll Number field\n if(empty($cell)){\n $_SESSION['user_edit_cell_error']=\"You Must have to Give Contact Number Here\";\n return false;\n }elseif($data['status']==true){\n $_SESSION['user_edit_cell_error']=\"This Contact Number has been already used\";\n return false;\n }elseif(!$cell_validity){\n $_SESSION['user_edit_cell_error']=\"Give a Proper Phone Number of Bangladesh\";\n return false;\n }else{\n return true;\n }\n }", "public function g_move_onto_board_set_D (Player $x_player) \n{\n \n $x_piece_pointer = $this->g_find_to_move_onto_board($x_player);\n\n if($x_piece_pointer == 0) \n {\n\n //no more pieces to move on to the board\n $this->g_logmove( \"<font color=orange>Player \" . $x_player->p_get_playerid() . \" did not have pieces off the board to move into play.</font>\");\n \n return FALSE;\n \n }\n \n else\n \n {\n\n $this->g_marker_move($x_player, $x_piece_pointer);\n\n return TRUE;\n } \n}", "function checkifsameloc(){\n\t\tif($this->world->checklocation($this->posx, $this->posy + 1) && $this->world->checklocation($this->posx, $this->posy - 1)){\n\t\t\t\tif(rand(2,1) == 1){\n\t\t\t\t\t$this->posy++;\n\t\t\t\t} else {\n\t\t\t\t\t$this->posy++;\n\t\t\t\t}\n\t\t\t} elseif($this->world->checklocation($this->posx, $this->posy + 1)){\n\t\t\t\t$this->posy--;\n\t\t\t} else {\n\t\t\t\t$this->posy++;\n\t\t\t}\n\t\t//$this->appendtoturn(\"<b>\" . $this->type . \"</b>(\" . $this->stamina . \") ERROR STATE AT \" . $this->world->nest[$this->type]->posx . \"-\" . $this->world->nest[$this->type]->posy);\n\t\t//uncomment to check when this function is firing, and on what object.\n\t}", "public function validateMove( $gameUnitUID, $targetX, $targetY, $userUID ){\n\n\t\t//Grab the gameUnit \n\t\t$gameUnitModelInstance \t= ClassRegistry::init( 'GameUnit' );\n\t\t$gameUnit \t\t\t\t= $gameUnitModelInstance->findForMoveValidation( $gameUnitUID );\n\t\t\n\t\t//The gameUnit find will return false if there's another unit in this game that\n\t\t//is currently selected.\n\t\tif( $gameUnit == false ){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t//Make sure the unit has a user game that belongs to the user and that the game \n\t\t//and the game unit are on the same turn\n\t\tif( $gameUnit['GameUnit']['users_uid'] != $userUID ){\n\t\t\treturn false;\n\t\t}\n\t\t\t\t\n\t\t//Make sure the given user is the active user for the current game\n\t\t$activeUserModelInstance = ClassRegistry::init( 'ActiveUser' );\n\t\t$activePlayer = $activeUserModelInstance->findActiveUser( $gameUnit['Game']['uid'], $gameUnit['Game']['turn'] );\n\t\tif( ! isset( $activePlayer ) or $activePlayer['UserGame']['users_uid'] != $userUID ){\n\t\t\treturn false;\n\t\t}\n\t\t\t\t\n\t\t//Get the new priority for this unit\n\t\t$movePriority = $gameUnit['GameUnit']['last_movement_priority'];\n\t\t\n\t\t//Grab the staring positions and last move angle\n\t\t$startX \t = $gameUnit['GameUnit']['x'];\n\t\t$startY \t = $gameUnit['GameUnit']['y'];\n\t\t$lastAngle\t = $gameUnit['GameUnit']['last_movement_angle'];\n\t\t$gameUID \t = $gameUnit['Game']['uid'];\n\t\t\n\t\t\n\t\t//Grab an array of the possible movements\n\t\tif( $movePriority == 0 ){\n\t\t\t\n\t\t\t$gameUnitMovementSets = $gameUnitModelInstance->findAllMovementSetsWithPriority( $gameUnitUID, $movePriority );\n\t\t\t\n\t\t}else{\n\n\t\t\t//Setup a MovementSet instance to grab this one set\n\t\t\t$movementSetModelInstance = ClassRegistry::init( 'MovementSet' );\n\t\t\t$gameUnitMovementSets = [\n [\n 'MovementSet' => array_merge(\n [ 'uid' => $gameUnit['GameUnit']['movement_sets_uid'] ],\n $movementSetModelInstance->findByUIDWithPriority( $gameUnit['GameUnit']['movement_sets_uid'], $movePriority )\n )\n ]\n ];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\t//See if any of the possible movements can get the unit to the target\n\t\tforeach( $gameUnitMovementSets as $movementSets ){\n\t\t\tforeach( $movementSets['MovementSet']['Movement'] as $movement ){\n\t\t\n\t\t\t\t//Grab the spaces this move can travel along with whether it\n\t\t\t\t//must travel them all or only some\n\t\t\t\t$spaces\t\t\t\t= intval( $movement['spaces'] );\n\t\t\t\t$mustMoveAllTheWay\t= intval( $movement['must_move_all_the_way'] );\n\t\t\t\t\t\t\t\t\n\t\t\t\t//Loop through all the movement direction sets and direction sets\n\t\t\t\tforeach( $movement['MovementDirectionSet'] as $movementDirectionSet ){\n\t\t\t\t\tforeach( $movementDirectionSet['DirectionSet']['DirectionSetDirection'] as $directionSetDirection ){\n\t\t\t\t\t\n\t\t\t\t\t\t//Grab the direction\n\t\t\t\t\t\t$direction = $directionSetDirection['Direction'];\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Get the angle \n\t\t\t\t\t\t$angleToCheck = $direction['angle'] + $lastAngle;\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Grab the x and y direction we'll be checking\n\t\t\t\t\t\t$xDirection = intval( round( sin( $angleToCheck * ( pi() / 180 ) ) ) );\n\t\t\t\t\t\t$yDirection = - intval( round( cos( $angleToCheck * ( pi() / 180 ) ) ) );\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Check if the unit has to move all the way\t\t\t\t\t\t\n\t\t\t\t\t\tif( $mustMoveAllTheWay ){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//Find the x and y to check and if they're successful then we can return true\n\t\t\t\t\t\t\t$xToCheck = $startX + ( $spaces * $xDirection );\n\t\t\t\t\t\t\t$yToCheck = $startY + ( $spaces * $yDirection );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//If we have a match, update the game and then return true\n\t\t\t\t\t\t\tif( $xToCheck == $targetX and $yToCheck == $targetY ){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t$this->updateGame( \n\t\t\t\t\t\t\t\t\t$gameUID,\n\t\t\t\t\t\t\t\t\t$gameUnit['GameUnit']['turn'],\n\t\t\t\t\t\t\t\t\t$gameUnitUID,\n\t\t\t\t\t\t\t\t\t$targetX,\n\t\t\t\t\t\t\t\t\t$targetY,\n\t\t\t\t\t\t\t\t\t$angleToCheck,\n\t\t\t\t\t\t\t\t\t$movePriority,\n\t\t\t\t\t\t\t\t\t$movementSets['MovementSet']['uid']\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t}else{\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t//Check the x and y of each space we move along\n\t\t\t\t\t\t\tfor( $spaceCounter = 1; $spaceCounter <= $spaces; $spaceCounter++ ){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t$xToCheck = $startX + ( $spaceCounter * $xDirection );\n\t\t\t\t\t\t\t\t$yToCheck = $startY + ( $spaceCounter * $yDirection );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t//If we have a match, update the game and then return true\n\t\t\t\t\t\t\t\tif( $xToCheck == $targetX and $yToCheck == $targetY ){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$this->updateGame( \n\t\t\t\t\t\t\t\t\t\t$gameUID, \n\t\t\t\t\t\t\t\t\t\t$gameUnit['GameUnit']['turn'], \n\t\t\t\t\t\t\t\t\t\t$gameUnitUID, \n\t\t\t\t\t\t\t\t\t\t$targetX, \n\t\t\t\t\t\t\t\t\t\t$targetY,\n $angleToCheck,\n\t\t\t\t\t\t\t\t\t\t$movePriority,\n\t\t\t\t\t\t\t\t\t\t$movementSets['MovementSet']['uid']\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t}\t\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\t//If we found no match we return false because we couldn't validate the move\n\t\treturn false;\n\n\t}", "private function validateDuplicateCoordinates()\n {\n $left = $this->getLeftName();\n $right = $this->getRightName();\n $table = $this->getTable();\n\n $result = DB::select(\n DB::raw(\"SELECT count(*) as count\n FROM $table AS C\n JOIN $table AS D\n WHERE C.id != D.id\n AND (\n C.$left = D.$left\n OR C.$left = D.$right\n OR C.$right = D.$right\n )\"\n )\n );\n\n if ($result[0]->count > 0)\n {\n throw new DuplicateCoordinateException;\n }\n }", "public function testOverwritePositionContent()\r\n {\r\n $this->game->makeMove(0, 0, 'X');\r\n $this->game->makeMove(0, 0, 'O');\r\n\r\n $cell = $this->game->board->getPositionContent(0,0);\r\n\r\n $this->assertEquals($cell, 'X');\r\n\r\n }", "function canMove()\n {\n return $this->canMoveFrom();\n }", "function suggest_moves($border, $value, $grid_size) {\n if(($value < $grid_size-1) && ($value > 0)){\n $alt_move_opts = \"left, right\";\n }else{\n switch ($border) {\n case 'north':\n case 'west':\n if($value==$grid_size-1){\n $alt_move_opts = \"left\";\n }elseif($value==0){\n $alt_move_opts = \"right\";\n }\n break;\n\n case 'south':\n case 'east':\n if($value==$grid_size-1){\n $alt_move_opts = \"right\";\n }elseif($value==0){\n $alt_move_opts = \"left\";\n }\n break;\n\n default:\n # code...\n break;\n }\n } \n $alt_move = \"Available moves: \".$alt_move_opts;\n $cmd_debug = \"<br />[error] Hitting the \".$border.\" border<br />alternate: \".$alt_move;\n $err_output = \"<br />Robot crossed the \".$border.\" edge.<br />\"; //.$alt_move;\n\n return array($alt_move, $cmd_debug, $err_output);\n}" ]
[ "0.74792176", "0.7100377", "0.70355546", "0.66251993", "0.63873297", "0.62701637", "0.6133941", "0.6111777", "0.60041857", "0.59299535", "0.592703", "0.5913914", "0.5898807", "0.58962154", "0.5895474", "0.5775219", "0.5748676", "0.5721967", "0.5703462", "0.5626792", "0.56063294", "0.56044143", "0.55856246", "0.55552614", "0.55494744", "0.55346185", "0.5530809", "0.55217856", "0.551092", "0.5471732" ]
0.8450107
0
test validateMove() Also checkOccupiedBySameColor()
public function testValidMove_Piece_Move_OccupiedBySameColor() { $firstPawn = new Pawn(PieceColorEnum::BLACK()); $firstRook = new Rook(PieceColorEnum::BLACK()); $this->_testSubject->getBoard()->add($firstPawn, 6, 3); $this->_testSubject->getBoard()->add($firstRook, 6, 2); $test = $this->_testSubject->validateMove($firstPawn, 6, 2); $this->assertFalse($test); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testValidMove()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $test = $this->_testSubject->validateMove($firstPawn, 8, 2);\n $this->assertFalse($test);\n }", "public function testMakeMove_Piece_Move_OccupiedByDifferentColor()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $firstRook = new Rook(PieceColorEnum::WHITE());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $this->_testSubject->getBoard()->add($firstRook, 6, 2);\n $this->_testSubject->makeMove($firstPawn, 6, 2);\n $this->assertEquals(2, $firstPawn->getYCoordinate());\n }", "public function testValidMove_Not_Same_Cell()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $test = $this->_testSubject->validateMove($firstPawn, 6, 3);\n $this->assertFalse($test);\n }", "function check_bounds($i, $moves, $move_result, $grid_size, $facing, $cmd_debug, $movement_commands){\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] *** check_bounds()<br />\";\n $cmd_debug .= \"[\".$i.\"] *** \".$moves[$i-1][0].\" < 0 | \".$move_result[0].\" >= \".$grid_size.\" | \".$move_result[1].\" < 0 | \".$move_result[1].\" >= \".$grid_size.\"<br />\";\n\n if($moves[$i-1][0] < 0 | $move_result[0] >= $grid_size | $move_result[1] < 0 | $move_result[1] >= $grid_size | $move_result[0] < 0){\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] ** Test Fail @ check_bounds() test A<br />\";\n\n }elseif($moves[$i][0] == '' && $moves[$i-1][0] == 0){\n $move_validity = true;\n $cmd_debug .= \"[\".$i.\"] ** Test Pass @ check_bounds() A<br />\";\n }else{\n if ($facing==='south' && $moves[$i-1][1]==0 && $movement_commands[$i]!='report') {\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] ** Test Fail @ check_bounds() test C<br />\";\n\n }elseif ($facing==='west' && $move_result[0] < 0) {\n $move_validity = false;\n $cmd_debug .= \"[\".$i.\"] ** Test Fail @ check_bounds() test D<br />\";\n }else{\n $move_validity = true;\n $cmd_debug .= \"[\".$i.\"] ** Test Pass @ check_bounds() B<br />\";\n }\n }\n if($move_validity){\n $cmd_debug .= \"[\".$i.\"] ** Valid Move **<br />\";\n }else{\n $cmd_debug .= \"[\".$i.\"] ** Invalid Move **<br />\";\n \n }\n return array($move_validity, $cmd_debug);\n}", "public function testValidMove_Piece_Move_IllegalCoordinates_Left_DoesNotMove()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 6, 3);\n $test = $this->_testSubject->validateMove($firstPawn, 4, 3);\n $this->assertFalse($test);\n }", "private function isValidMove($id) {\n if ($id==$this->pos) {\n return false;\n }\n if ($id+$this->size==$this->pos) {\n return true;\n }\n if ($id-$this->size==$this->pos) {\n return true;\n }\n if ($id+1==$this->pos && ($id+1)%4!=0) {\n return true;\n }\n if ($id-1==$this->pos && ($id-1)%4!=3) {\n return true;\n }\n return false;\n }", "private function move() {\n\n \n switch ($this->direction) {\n case 'N':\n if($this->address['row'] == $this->block['col']){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['row'] ++; // add rows on move to north\n break;\n case 'E':\n if($this->address['col'] == $this->block['col']){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['col'] ++; // add cols on move to east\n break;\n case 'S':\n if($this->address['row'] == 0){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['row'] --; // deduct rows on move to south\n break;\n case 'W':\n if($this->address['col'] == 0){return false;} //add validation to the move so the mower will not go out of the lawn due to human error\n $this->address['col'] --; // deduct rows on move to west\n break;\n }\n\n\n return true;\n\n }", "public function testBestMoveForWinnableStatusShouldReturnWinnableMoveCoordinates()\n {\n $bot = new Bot();\n\n $this->assertEquals([2, 0], $bot->makeMove([\n ['X', 'X', ''],\n ['O', 'X', 'X'],\n ['', 'O', 'O'],\n ], 'O'));\n }", "public function testMakeMove_Piece_Move_LegalCoordinates_Forward_DoesMove()\n {\n $firstPawn = new Pawn(PieceColorEnum::BLACK());\n $this->_testSubject->getBoard()->add($firstPawn, 5, 3);\n $this->_testSubject->makeMove($firstPawn, 5, 2);\n $this->assertEquals(2, $firstPawn->getYCoordinate());\n }", "private function checkDraw() {\n return $this->movesTaken == SIZE * SIZE;\n }", "public function can_move_based_on_movable_position()\n {\n $testPos = ['x' => 0, 'y' => 1, 'face' => 'NORTH'];\n $this->robot->setCurrentPosition($testPos);\n \n $newPos = $this->robot->canMove();\n $expectPos = ['x'=>0, 'y' => 2, 'face' => 'NORTH'];\n $this->assertEquals($expectPos, $newPos);\n }", "public function testBestMoveForDefendingStatusShouldReturnDefendingMoveCoordinates()\n {\n $bot = new Bot();\n\n $this->assertEquals([2, 2], $bot->makeMove([\n ['X', '', 'O'],\n ['O', 'X', ''],\n ['X', '', ''],\n ], 'O'));\n }", "public function validateMove( $gameUnitUID, $targetX, $targetY, $userUID ){\n\n\t\t//Grab the gameUnit \n\t\t$gameUnitModelInstance \t= ClassRegistry::init( 'GameUnit' );\n\t\t$gameUnit \t\t\t\t= $gameUnitModelInstance->findForMoveValidation( $gameUnitUID );\n\t\t\n\t\t//The gameUnit find will return false if there's another unit in this game that\n\t\t//is currently selected.\n\t\tif( $gameUnit == false ){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t//Make sure the unit has a user game that belongs to the user and that the game \n\t\t//and the game unit are on the same turn\n\t\tif( $gameUnit['GameUnit']['users_uid'] != $userUID ){\n\t\t\treturn false;\n\t\t}\n\t\t\t\t\n\t\t//Make sure the given user is the active user for the current game\n\t\t$activeUserModelInstance = ClassRegistry::init( 'ActiveUser' );\n\t\t$activePlayer = $activeUserModelInstance->findActiveUser( $gameUnit['Game']['uid'], $gameUnit['Game']['turn'] );\n\t\tif( ! isset( $activePlayer ) or $activePlayer['UserGame']['users_uid'] != $userUID ){\n\t\t\treturn false;\n\t\t}\n\t\t\t\t\n\t\t//Get the new priority for this unit\n\t\t$movePriority = $gameUnit['GameUnit']['last_movement_priority'];\n\t\t\n\t\t//Grab the staring positions and last move angle\n\t\t$startX \t = $gameUnit['GameUnit']['x'];\n\t\t$startY \t = $gameUnit['GameUnit']['y'];\n\t\t$lastAngle\t = $gameUnit['GameUnit']['last_movement_angle'];\n\t\t$gameUID \t = $gameUnit['Game']['uid'];\n\t\t\n\t\t\n\t\t//Grab an array of the possible movements\n\t\tif( $movePriority == 0 ){\n\t\t\t\n\t\t\t$gameUnitMovementSets = $gameUnitModelInstance->findAllMovementSetsWithPriority( $gameUnitUID, $movePriority );\n\t\t\t\n\t\t}else{\n\n\t\t\t//Setup a MovementSet instance to grab this one set\n\t\t\t$movementSetModelInstance = ClassRegistry::init( 'MovementSet' );\n\t\t\t$gameUnitMovementSets = [\n [\n 'MovementSet' => array_merge(\n [ 'uid' => $gameUnit['GameUnit']['movement_sets_uid'] ],\n $movementSetModelInstance->findByUIDWithPriority( $gameUnit['GameUnit']['movement_sets_uid'], $movePriority )\n )\n ]\n ];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t}\n\t\t\t\t\n\t\t//See if any of the possible movements can get the unit to the target\n\t\tforeach( $gameUnitMovementSets as $movementSets ){\n\t\t\tforeach( $movementSets['MovementSet']['Movement'] as $movement ){\n\t\t\n\t\t\t\t//Grab the spaces this move can travel along with whether it\n\t\t\t\t//must travel them all or only some\n\t\t\t\t$spaces\t\t\t\t= intval( $movement['spaces'] );\n\t\t\t\t$mustMoveAllTheWay\t= intval( $movement['must_move_all_the_way'] );\n\t\t\t\t\t\t\t\t\n\t\t\t\t//Loop through all the movement direction sets and direction sets\n\t\t\t\tforeach( $movement['MovementDirectionSet'] as $movementDirectionSet ){\n\t\t\t\t\tforeach( $movementDirectionSet['DirectionSet']['DirectionSetDirection'] as $directionSetDirection ){\n\t\t\t\t\t\n\t\t\t\t\t\t//Grab the direction\n\t\t\t\t\t\t$direction = $directionSetDirection['Direction'];\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Get the angle \n\t\t\t\t\t\t$angleToCheck = $direction['angle'] + $lastAngle;\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Grab the x and y direction we'll be checking\n\t\t\t\t\t\t$xDirection = intval( round( sin( $angleToCheck * ( pi() / 180 ) ) ) );\n\t\t\t\t\t\t$yDirection = - intval( round( cos( $angleToCheck * ( pi() / 180 ) ) ) );\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Check if the unit has to move all the way\t\t\t\t\t\t\n\t\t\t\t\t\tif( $mustMoveAllTheWay ){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//Find the x and y to check and if they're successful then we can return true\n\t\t\t\t\t\t\t$xToCheck = $startX + ( $spaces * $xDirection );\n\t\t\t\t\t\t\t$yToCheck = $startY + ( $spaces * $yDirection );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//If we have a match, update the game and then return true\n\t\t\t\t\t\t\tif( $xToCheck == $targetX and $yToCheck == $targetY ){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t$this->updateGame( \n\t\t\t\t\t\t\t\t\t$gameUID,\n\t\t\t\t\t\t\t\t\t$gameUnit['GameUnit']['turn'],\n\t\t\t\t\t\t\t\t\t$gameUnitUID,\n\t\t\t\t\t\t\t\t\t$targetX,\n\t\t\t\t\t\t\t\t\t$targetY,\n\t\t\t\t\t\t\t\t\t$angleToCheck,\n\t\t\t\t\t\t\t\t\t$movePriority,\n\t\t\t\t\t\t\t\t\t$movementSets['MovementSet']['uid']\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t}else{\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t//Check the x and y of each space we move along\n\t\t\t\t\t\t\tfor( $spaceCounter = 1; $spaceCounter <= $spaces; $spaceCounter++ ){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t$xToCheck = $startX + ( $spaceCounter * $xDirection );\n\t\t\t\t\t\t\t\t$yToCheck = $startY + ( $spaceCounter * $yDirection );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t//If we have a match, update the game and then return true\n\t\t\t\t\t\t\t\tif( $xToCheck == $targetX and $yToCheck == $targetY ){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t$this->updateGame( \n\t\t\t\t\t\t\t\t\t\t$gameUID, \n\t\t\t\t\t\t\t\t\t\t$gameUnit['GameUnit']['turn'], \n\t\t\t\t\t\t\t\t\t\t$gameUnitUID, \n\t\t\t\t\t\t\t\t\t\t$targetX, \n\t\t\t\t\t\t\t\t\t\t$targetY,\n $angleToCheck,\n\t\t\t\t\t\t\t\t\t\t$movePriority,\n\t\t\t\t\t\t\t\t\t\t$movementSets['MovementSet']['uid']\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t}\t\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\t//If we found no match we return false because we couldn't validate the move\n\t\treturn false;\n\n\t}", "function checkifsameloc(){\n\t\tif($this->world->checklocation($this->posx, $this->posy + 1) && $this->world->checklocation($this->posx, $this->posy - 1)){\n\t\t\t\tif(rand(2,1) == 1){\n\t\t\t\t\t$this->posy++;\n\t\t\t\t} else {\n\t\t\t\t\t$this->posy++;\n\t\t\t\t}\n\t\t\t} elseif($this->world->checklocation($this->posx, $this->posy + 1)){\n\t\t\t\t$this->posy--;\n\t\t\t} else {\n\t\t\t\t$this->posy++;\n\t\t\t}\n\t\t//$this->appendtoturn(\"<b>\" . $this->type . \"</b>(\" . $this->stamina . \") ERROR STATE AT \" . $this->world->nest[$this->type]->posx . \"-\" . $this->world->nest[$this->type]->posy);\n\t\t//uncomment to check when this function is firing, and on what object.\n\t}", "public function testValidateExpression()\n\t{\n\t\t// From a a place to a transition.\n\t\t// Create a place.\n\t\t$colorSet = new PNColorSet(array('integer', 'double', 'array'));\n\t\t$place = new PNPlace($colorSet);\n\t\tTestReflection::setValue($this->object, 'input', $place);\n\n\t\t// Create a transition.\n\t\t$colorSet = new PNColorSet(array('integer', 'double', 'array'));\n\t\t$transition = new PNTransition($colorSet);\n\t\tTestReflection::setValue($this->object, 'output', $transition);\n\n\t\t// Mock the expression.\n\t\t$expression1 = $this->getMockForAbstractClass('PNArcExpression', array(array('integer', 'double', 'array')));\n\t\t$expression1->expects($this->once())\n\t\t\t->method('execute')\n\t\t\t->will($this->returnValue(array(8, 8.2, array())));\n\n\t\tTestReflection::setValue($this->object, 'expression', $expression1);\n\n\t\t$this->assertTrue($this->object->validateExpression());\n\n\t\t// Test a sub-set of the transition color set.\n\t\t$expression2 = $this->getMockForAbstractClass('PNArcExpression', array(array('integer', 'double', 'array')));\n\t\t$expression2->expects($this->once())\n\t\t\t->method('execute')\n\t\t\t->will($this->returnValue(array(8, 8.2)));\n\n\t\tTestReflection::setValue($this->object, 'expression', $expression2);\n\n\t\t$this->assertTrue($this->object->validateExpression());\n\n\t\t// Test with non matching transition color set return values types.\n\t\t$expression3 = $this->getMockForAbstractClass('PNArcExpression', array(array('integer', 'double', 'array')));\n\t\t$expression3->expects($this->once())\n\t\t\t->method('execute')\n\t\t\t->will($this->returnValue(array('test')));\n\n\t\tTestReflection::setValue($this->object, 'expression', $expression3);\n\n\t\t$this->assertFalse($this->object->validateExpression());\n\n\t\t// Test with non matching expression arguments.\n\t\t$expression4 = $this->getMockForAbstractClass('PNArcExpression', array(array('double', 'double', 'array')));\n\t\tTestReflection::setValue($this->object, 'expression', $expression4);\n\t\t$this->assertFalse($this->object->validateExpression());\n\n\t\t// From a transition to a place.\n\t\t// Create a transition.\n\t\t$colorSet = new PNColorSet(array('integer', 'double', 'array'));\n\t\t$transition = new PNTransition($colorSet);\n\t\tTestReflection::setValue($this->object, 'input', $transition);\n\n\t\t$colorSet = new PNColorSet(array('integer', 'double', 'array'));\n\t\t$place = new PNPlace($colorSet);\n\t\tTestReflection::setValue($this->object, 'output', $place);\n\n\t\t// Mock the expression.\n\t\t$expression1 = $this->getMockForAbstractClass('PNArcExpression', array(array('integer', 'double', 'array')));\n\t\t$expression1->expects($this->once())\n\t\t\t->method('execute')\n\t\t\t->will($this->returnValue(array(8, 8.2, array())));\n\n\t\tTestReflection::setValue($this->object, 'expression', $expression1);\n\n\t\t$this->assertTrue($this->object->validateExpression());\n\t}", "protected function makeMove($move)\n {\n // m oveToS AN($m ove)\n // p erft($d epth, $full = false)\n // g enPossibleMoves($o ptions = [])\n $us = $this->get_turn();\n $them = self::swap_color($us);\n $historyKey = $this->recordMove($move);\n\n $this->board[$move['to']] = $this->board[$move['from']];\n $this->board[$move['from']] = null;\n\n\n\n // if flags:EP_CAPTURE (en passant), remove the captured pawn\n if ($move['flags'] & self::BITS['EP_CAPTURE']) {\n $this->board[$move['to'] + ($us == self::BLACK ? -16 : 16)] = null;\n }\n\n // if pawn promotion, replace with new piece\n if ($move['flags'] & self::BITS['PROMOTION']) {\n $this->board[$move['to']] = ['type' => $move['promotion'], 'color' => $us];\n }\n\n // if big pawn move, update the en passant square\n if ($move['flags'] & self::BITS['BIG_PAWN']) {\n $this->epSquare = $move['to'] + ($us == self::BLACK ? -16 : 16);\n } else {\n $this->epSquare = null;\n }\n\n\n\n // reset the 50 move counter if a pawn is moved or piece is captured\n if ($move['piece'] === self::PAWN) {\n $this->halfMoves = 0;\n } elseif ($move['flags'] & (self::BITS['CAPTURE'] | self::BITS['EP_CAPTURE'])) {\n $this->halfMoves = 0;\n } else {\n ++$this->halfMoves;\n }\n\n // if we moved the king\n if ($this->board[$move['to']]['type'] === self::KING) {\n //~ $this->kings[$this->board[$move['to']]['color']] = $move['to'];\n $this->kings[$us] = $move['to'];\n\n // IF WE CASTLED, move the rook next to the king\n if ($move['flags'] & self::BITS['KSIDE_CASTLE']) {\n $castlingTo = $move['to'] - 1;\n $castlingFrom = $move['to'] + 1;\n $this->board[$castlingTo] = $this->board[$castlingFrom];\n $this->board[$castlingFrom] = null;\n } elseif ($move['flags'] & self::BITS['QSIDE_CASTLE']) {\n $castlingTo = $move['to'] + 1;\n $castlingFrom = $move['to'] - 2;\n $this->board[$castlingTo] = $this->board[$castlingFrom];\n $this->board[$castlingFrom] = null;\n }\n\n $this->castling[$us] = 0; // or maybe ''\n }\n\n // turn of castling of we move a rock\n if ($this->castling[$us] > 0) {\n for ($i = 0, $len = count(self::ROOKS[$us]); $i < $len; ++$i) {\n if (\n $move['from'] === self::ROOKS[$us][$i]['square'] &&\n $this->castling[$us] & self::ROOKS[$us][$i]['flag']\n ) {\n $this->castling[$us] ^= self::ROOKS[$us][$i]['flag'];\n break;\n }\n }\n }\n\n // turn of castling of we capture a rock\n if ($this->castling[$them] > 0) {\n for ($i = 0, $len = count(self::ROOKS[$them]); $i < $len; ++$i) {\n if (\n $move['to'] === self::ROOKS[$them][$i]['square'] &&\n $this->castling[$them] & self::ROOKS[$them][$i]['flag']\n ) {\n $this->castling[$them] ^= self::ROOKS[$them][$i]['flag'];\n break;\n }\n }\n }\n\n\n if ($us === self::BLACK) {\n ++$this->moveNumber;\n }\n $this->turn = $them;\n\n //~ echo $historyKey . '<br />';\n // needed caching for short inThreefoldRepetition()\n $this->history[$historyKey]['position'] = $this->fen(true);\n }", "private function testTwo(){\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,4),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell up\");\r\n\t\t\r\n\t\t//2 cell snake going down\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,6),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell down\");\r\n\t\t\r\n\t\t//4 cell snake going up\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,2),\r\n\t\t\t$this->getCoordinateObj(5,3),\r\n\t\t\t$this->getCoordinateObj(5,4),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell up\");\r\n\t\t\r\n\t\t//4 cell snake going down\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(5,8),\r\n\t\t\t$this->getCoordinateObj(5,7),\r\n\t\t\t$this->getCoordinateObj(5,6),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell down\");\r\n\t}", "public function validate()\n {\n $this->validateDuplicateCoordinates();\n $this->validateWrongBorder();\n $this->validate_coordinate_order();\n $this->validate_number_of_descendants();\n }", "public function canMove(): bool\n {\n return count($this->visitedCoordinates) < $this->matrix->getSize();\n }", "public function validate(array $board, int $player, array $from, array $to)\n {\n if ($board[$from[0]][$from[1]][1] !== $player) {\n throw new InvalidMoveException('You must choose a piece that belongs to you.');\n }\n }", "public function testValidateHex()\n {\n $user = User::findOne(1002);\n\n $this->specify('INVALID HEX color code', function() use ($user) {\n $model = new ScreenForm($user, [\n 'background' => 'invalid_hex_color',\n ]);\n $model->validateHex('background', []);\n\n verify('Error message should be set', $model->errors)->hasKey('background');\n });\n\n $this->specify('VALID HEX color code', function() use ($user) {\n $model = new ScreenForm($user, [\n 'background' => '#000000',\n ]);\n $model->validateHex('background', []);\n\n verify('Error message should not be set', $model->errors)->hasntKey('background');\n });\n }", "function checkWinConditions($move){\n\t\t$winningCombinations = array(\"-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\");\n\t\t$winner = \"none\";\n\t\t$winningCombinations[0] = $move[0].$move[1].$move[2];\n\t\t$winningCombinations[1] = $move[0].$move[4].$move[8];\n\t\t$winningCombinations[2] = $move[0].$move[3].$move[6];\n\t\t$winningCombinations[3] = $move[1].$move[4].$move[7];\n\t\t$winningCombinations[4] = $move[2].$move[5].$move[8];\n\t\t$winningCombinations[5] = $move[2].$move[4].$move[6];\n\t\t$winningCombinations[6] = $move[3].$move[4].$move[5];\n\t\t$winningCombinations[7] = $move[6].$move[7].$move[8];\n\t\tforeach($winningCombinations as $wincondition){\n\t\t\tif($wincondition==\"xxx\"){\n\t\t\t\t$winner = \"xwins\";\n\t\t\t\t// incrementSessionCounter(\"xwins\");\n\t\t\t\treturn $winner;\n\t\t\t}\n\t\t\telseif($wincondition==\"ooo\"){\n\t\t\t\t$winner = \"owins\";\n\t\t\t\t// incrementSes÷sionCounter(\"owins\");\n\t\t\t\treturn $winner;\n\t\t\t}\n\t\t}\n\t}", "function make_move(ChessSquare $old_square, ChessSquare $new_square): void {\n $moving_piece = clone $this->board[$old_square->rank][$old_square->file];\n \n $this->en_passant_target_square = NULL;\n \n $is_capture = $this->board[$new_square->rank][$new_square->file];\n \n if ( $moving_piece->type == ChessPiece::PAWN || $is_capture ) {\n $this->halfmove_clock = 0;\n } else {\n $this->halfmove_clock++;\n }\n \n $this->board[$new_square->rank][$new_square->file] = $moving_piece;\n \n // Update $moving_piece->square too to avoid errors.\n $moving_piece->square = $new_square;\n \n $this->board[$old_square->rank][$old_square->file] = NULL;\n \n if ( $this->color_to_move == ChessPiece::BLACK ) {\n $this->fullmove_number++;\n }\n \n $this->flip_color_to_move();\n }", "public function testHexColor(): void\n {\n $validator = new Validator();\n $this->assertProxyMethod($validator, 'hexColor');\n $this->assertEmpty($validator->validate(['username' => '#FFFFFF']));\n $this->assertNotEmpty($validator->validate(['username' => 'FFFFFF']));\n\n $fieldName = 'field_name';\n $rule = 'hexColor';\n $expectedMessage = 'The provided value must be a hex color';\n $this->assertValidationMessage($fieldName, $rule, $expectedMessage);\n }", "private function testOne(){\r\n\t\t$this->obj->you->body = [$this->getCoordinateObj(5,5)];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down,\r\n\t\t\t\\models\\MoveTypes::$Left,\r\n\t\t\t\\models\\MoveTypes::$Right\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"one-cell snake\");\r\n\t}", "private function testThree(){\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(4,5),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell left\");\r\n\t\t\r\n\t\t//2 cell snake going right\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(6,5),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"two-cell right\");\r\n\t\t\r\n\t\t//4 cell snake going left\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(2,5),\r\n\t\t\t$this->getCoordinateObj(3,5),\r\n\t\t\t$this->getCoordinateObj(4,5),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell left\");\r\n\t\t\r\n\t\t//4 cell snake going right\r\n\t\t$this->obj->you->body = [\r\n\t\t\t$this->getCoordinateObj(8,5),\r\n\t\t\t$this->getCoordinateObj(7,5),\r\n\t\t\t$this->getCoordinateObj(6,5),\r\n\t\t\t$this->getCoordinateObj(5,5)\r\n\t\t];\r\n\t\t$exmoves = [\r\n\t\t\t\\models\\MoveTypes::$Up,\r\n\t\t\t\\models\\MoveTypes::$Down\r\n\t\t];\r\n\t\t$this->runTest($exmoves,\"four-cell right\");\r\n\t}", "public function g_move_onto_board_set_D (Player $x_player) \n{\n \n $x_piece_pointer = $this->g_find_to_move_onto_board($x_player);\n\n if($x_piece_pointer == 0) \n {\n\n //no more pieces to move on to the board\n $this->g_logmove( \"<font color=orange>Player \" . $x_player->p_get_playerid() . \" did not have pieces off the board to move into play.</font>\");\n \n return FALSE;\n \n }\n \n else\n \n {\n\n $this->g_marker_move($x_player, $x_piece_pointer);\n\n return TRUE;\n } \n}", "public function testMoveNode()\n {\n }", "function suggest_moves($border, $value, $grid_size) {\n if(($value < $grid_size-1) && ($value > 0)){\n $alt_move_opts = \"left, right\";\n }else{\n switch ($border) {\n case 'north':\n case 'west':\n if($value==$grid_size-1){\n $alt_move_opts = \"left\";\n }elseif($value==0){\n $alt_move_opts = \"right\";\n }\n break;\n\n case 'south':\n case 'east':\n if($value==$grid_size-1){\n $alt_move_opts = \"right\";\n }elseif($value==0){\n $alt_move_opts = \"left\";\n }\n break;\n\n default:\n # code...\n break;\n }\n } \n $alt_move = \"Available moves: \".$alt_move_opts;\n $cmd_debug = \"<br />[error] Hitting the \".$border.\" border<br />alternate: \".$alt_move;\n $err_output = \"<br />Robot crossed the \".$border.\" edge.<br />\"; //.$alt_move;\n\n return array($alt_move, $cmd_debug, $err_output);\n}", "public function testValueValid() {\n $this->assertEmpty($this->getValidator()->validate('rgb(223, 255, 0)'));\n }" ]
[ "0.7679107", "0.7229065", "0.7097311", "0.63245225", "0.6323228", "0.6137432", "0.6115327", "0.6080202", "0.5963136", "0.58311296", "0.57871866", "0.57291734", "0.5722984", "0.5645037", "0.56289977", "0.5558618", "0.5557157", "0.55523664", "0.5482466", "0.5480693", "0.54548556", "0.53886795", "0.53884834", "0.53863966", "0.53684133", "0.53236", "0.5298105", "0.52825236", "0.5276362", "0.52675253" ]
0.829494
0
Test throwing the exception for a spec rule name.
public function testThrowingForSpecRuleName() { $this->expectException(InvalidSpecRuleName::class); $this->expectExceptionMessage("Invalid spec rule name 'specRuleName' was requested from the validator spec."); throw InvalidSpecRuleName::forSpecRuleName('specRuleName'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testException()\n {\n $rules = ['text' => ['required', 'max:5', 'samed:code']];\n $validator = new Validator(['text' => 'code'], $rules);\n try {\n $validator->passed();\n }catch (\\Exception $ex){\n $this->assertInstanceOf(RuleNotFoundException::class, $ex);\n }\n }", "public function testScenarioInvalidName(): void\n {\n $this->expectException(\\InvalidArgumentException::class);\n $this->expectExceptionCode(400);\n $this->expectExceptionMessage('Invalid character in scenario name: \"scenario test\"');\n\n $app = new Application($this->driver, $this->report);\n $task = &$this->task;\n $app->scenario('scenario test', function (PipelineInterface $pipeline) use ($task) {\n $pipeline->pipe($task);\n });\n\n $app->run(['scenario test']);\n }", "public function testValidateInvalidName($name)\n {\n $this->testValidateValidName($name);\n }", "public function testValidateMethodNameException()\n {\n $this->setExpectedException('Thormeier\\TransportClientBundle\\Exception\\UnknownApiMethodException');\n\n $this->service->get('foo', array());\n }", "public function testIfWrongNameThrows() : void\n {\n\n $this->expectException(ClassFopException::class);\n\n new Path('wro name');\n }", "public function testSettingInvalidName()\n {\n $this->expectException(\\InvalidArgumentException::class);\n $nameProperty = new AttachmentAction();\n $nameProperty->setName(null);\n }", "public function testException() {\n\n $this->setExpectedException($this->klade->addEntry(''));\n }", "private function throwExceptionIfNameInvalid(): void\n {\n $name = $this->name;\n if (is_null($name)) {\n $name = '*null*';\n }\n if (\n !preg_match(\n '/' . self::VALID_NAME . '/',\n $name\n )\n ) {\n throw new InvalidNameException(\n 'The given name (' . $name . ') is not valid for the specified action'\n );\n }\n }", "public function testValidateArbitraryName($name)\n {\n if (!BuiltinRecordUtil::isValidName($name, $message)) {\n $this->setExpectedException(\n \"Lousson\\\\Record\\\\Error\\\\RecordArgumentError\",\n $message, RecordArgumentError::E_INVALID_RECORD\n );\n }\n\n $this->testValidateValidName($name);\n }", "public function testAddRuleException()\n\t{\n\t\tTestHelper::invoke($this->StringInflector, 'addRule', new \\stdClass, 'singular');\n\t}", "public function testGetNameWithException()\n {\n $tableName = 'TEST_TABLE_NAME_' . mt_rand(100, 999);\n $event = \\Magento\\Framework\\DB\\Ddl\\Trigger::EVENT_INSERT;\n\n $this->_object->setTable($tableName)->setTime(\\Magento\\Framework\\DB\\Ddl\\Trigger::TIME_AFTER)->setEvent($event);\n\n $this->_object->getName();\n }", "public function testThrowsExceptionWhenInvalidFilenameIsSet()\n {\n $this->calc->setOutputFile('/text_file_in_root.txt');\n $this->setExpectedException('Exception');\n $this->invokeMethod($this->calc,'createFile');\n }", "public function testErrorMessagePassedCorrectly(): void\n {\n $this->expectExceptionMessage($this->message);\n\n throw $this->class;\n }", "public function testNameTooShortException(): void\n {\n $name = str_repeat('.', HostSeverity::MIN_NAME_LENGTH - 1);\n $this->expectException(\\InvalidArgumentException::class);\n $this->expectExceptionMessage(\n AssertionException::minLength(\n $name,\n strlen($name),\n HostSeverity::MIN_NAME_LENGTH,\n 'HostSeverity::name'\n )->getMessage()\n );\n new HostSeverity($name, 'alias', 42, $this->icon);\n }", "public function testGetTableNameException()\n {\n $this->setExpectedException('InvalidArgumentException', 'Shop id \"invalid_id\" is invalid.');\n\n $this->service->getTableName('invalid_id');\n }", "public function testRaiseExceptionWhenNoFileNameIsSpecified()\n {\n $file = new File;\n $this->setExpectedException(\n 'Asar\\FileSystem\\Exception',\n \"File::getResource failed. The file object does not have a file name.\"\n );\n $file->save();\n }", "public function testInvalidNames(): void\n {\n $configuration = new Configuration();\n $object = self::object('Invalid+Name', ['f' => 'String']);\n $input = self::input('Invli*Input', ['f' => 'String']);\n $object2 = self::object('GoodName', ['f' => 'String']);\n $badField = new FieldConfiguration('++BadFieldName', 'String');\n $object2->addField($badField);\n\n $object3 = new ObjectConfiguration('GoodObject');\n $field = new FieldConfiguration('GoodField', 'String');\n $badArgument = new ArgumentConfiguration('1BadArgument', 'Int');\n $field->addArgument($badArgument);\n $object3->addField($field);\n\n $configuration\n ->addType($object)\n ->addType($input)\n ->addType($object2)\n ->addType($object3);\n\n $errors = $this->getValidator()->validate($configuration);\n $this->assertCount(4, $errors);\n\n $errorObject = $errors->get(0);\n $this->assertEquals($errorObject->getInvalidValue(), $object);\n $this->assertEquals('The name \"Invalid+Name\" is not valid. Allowed characters are letters, numbers and _.', $errorObject->getMessage());\n\n $errorInput = $errors->get(1);\n $this->assertEquals($errorInput->getInvalidValue(), $input);\n $this->assertEquals('The name \"Invli*Input\" is not valid. Allowed characters are letters, numbers and _.', $errorInput->getMessage());\n\n $errorObject2 = $errors->get(2);\n $this->assertEquals($errorObject2->getInvalidValue(), $badField);\n $this->assertEquals('The name \"++BadFieldName\" is not valid. Allowed characters are letters, numbers and _.', $errorObject2->getMessage());\n\n $errorObject3 = $errors->get(3);\n $this->assertEquals($errorObject3->getInvalidValue(), $badArgument);\n $this->assertEquals('The name \"1BadArgument\" is not valid. Allowed characters are letters, numbers and _.', $errorObject3->getMessage());\n }", "public function testValidateValidName($name)\n {\n BuiltinRecordUtil::validateName($name);\n }", "public function testName() {\n $plugin = new Plugin();\n $plugin->setName('foo');\n $this->assertEquals('foo', $plugin->getName());\n \n $plugin = new Plugin(null, array('name' => 'bar'));\n $this->assertEquals('bar', $plugin->getName());\n \n $this->setExpectedException('Nimbles\\Core\\Plugin\\Exception\\InvalidName');\n $plugin->setName(123);\n }", "public function testNameEmptyException(): void\n {\n $name = '';\n $this->expectException(\\InvalidArgumentException::class);\n $this->expectExceptionMessage(\n AssertionException::notEmpty(\n 'MetaService::name'\n )->getMessage()\n );\n new MetaService(1, 10, 1, $name, 'Central', new ServiceStatus('OK', 0, 0));\n }", "public function testDeleteRuleNotExists()\n {\n $this->setExpectedException('\\SLiib\\WebApp\\Security\\Exception\\CheckerError');\n $rule = $this->object->deleteRule(1337);\n }", "public function testGetName()\n {\n $rule = new Formagic_Rule_Mock_MockRule();\n $actual = $rule->getName();\n $this->assertEquals('Mock_MockRule', $actual);\n }", "public function testOptionNotFoundExceptionContainsOptionName()\n {\n $this->assertContains('OPTION_NAME', $this->exception->getMessage());\n }", "public function testLoaderClassIllegalFilename()\n {\n $this->setExpectedException('\\\\Zend\\\\Loader\\\\SecurityException', 'Illegal character');\n Loader::loadClass('/path/:to/@danger');\n }", "public function testThrowsExceptionWhenNoFilenameIsSet()\n {\n $this->setExpectedException('Exception');\n $this->invokeMethod($this->calc,'createFile');\n }", "private function _validateName($name) {\n if (!isset($name) || strlen($name) === 0) {\n throw new Exception(\"name must be set and not empty\");\n }\n }", "public function invalidOperationNameTestCases() {\n return [\n ['invalid-op'],\n ['foo-add-transition'],\n ['add-transition-bar'],\n ];\n }", "public function testNameTooLongException(): void\n {\n $name = str_repeat('.', HostSeverity::MAX_NAME_LENGTH + 1);\n $this->expectException(\\InvalidArgumentException::class);\n $this->expectExceptionMessage(\n AssertionException::maxLength(\n $name,\n strlen($name),\n HostSeverity::MAX_NAME_LENGTH,\n 'HostSeverity::name'\n )->getMessage()\n );\n new HostSeverity($name, 'alias', 42, $this->icon);\n }", "function throwError($errorName){\r\n\t\t\tswitch ($errorName) {\r\n\t\tcase \"invalidPrivateKey\":\r\n\t\t\treturn \"Sorry, this didnt work. Admins used an invalid key. Bug them about it!\";\r\n\t\t\tbreak;\r\n\t\tcase 1:\r\n\t\t\techo \"i equals 1\";//WHAT IS THIS ERROR???\r\n\t\t\tbreak;\r\n\t\tcase 2:\r\n\t\t\techo \"i equals 2\";//WHAT IS THIS ERROR???\r\n\t\t\tbreak;\r\n\t\t\t}\r\n\t}", "public function testNotFoundException( )\n {\n $this->expectException( NotFoundExceptionInterface::class );\n $this->expectException( SalesmanNotFoundException::class );\n $this->sut->get( 22 );\n }" ]
[ "0.70023096", "0.69839674", "0.6825967", "0.6794277", "0.675717", "0.66439104", "0.6586576", "0.6506877", "0.6436046", "0.64175487", "0.63438493", "0.6252054", "0.62335527", "0.61676276", "0.614532", "0.61422306", "0.6127083", "0.60950065", "0.60867226", "0.599624", "0.59844905", "0.59800166", "0.59794015", "0.5942813", "0.5916269", "0.59161663", "0.5893369", "0.5883447", "0.58830595", "0.5882175" ]
0.853717
0
Removes Order Notes Additional Information Field.
function remove_order_notes( $fields ) { unset( $fields['order']['order_comments'] ); return $fields; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ghc_e3_remove_order_notes( $fields ) {\n unset( $fields['order']['order_comments'] );\n return $fields;\n}", "function delete_order_note($order_id, $id) {\n if ($id > 0) {\n wp_delete_comment($id);\n }\n return $this->get_order_notes($order_id);\n }", "public function remove_renewal_order_meta( $order_meta ) {\n\n\t\tforeach ( $order_meta as $index => $meta ) {\n\n\t\t\tif ( '_pip_invoice_number' === $meta['meta_key'] ) {\n\t\t\t\tunset( $order_meta[ $index ] );\n\t\t\t}\n\t\t}\n\n\t\treturn $order_meta;\n\t}", "function removing_customer_details_in_emails( $order, $sent_to_admin, $plain_text, $email ){\n$wmail = WC()->mailer();\nremove_action( 'woocommerce_email_customer_details', array( $wmail, 'email_addresses' ), 20, 3 );\n}", "public function clearWarehouseNotes()\n {\n $this->collWarehouseNotes = null; // important to set this to NULL since that means it is uninitialized\n }", "function delete_customer_note() {\n $note_id = (int) $_POST['note_id'];\n\n if ($note_id>0) :\n wp_delete_comment( $note_id );\n endif;\n\n // Quit out\n die();\n }", "public function deleteNotes() {\r\n\t\t$query1 = \"delete from \\\"frbr:creator\\\" where object = 'Esta obra es una compilación de varias obras.'\";\r\n\t\t$result1 = pg_query ( $this->dbConn, $query1 );\r\n\t}", "public function remove_information($i_id=0);", "function deleteNote($noteID)\n\t{\n\t\tglobal $db;\n\n\t\tif ($noteID)\n\t\t{\n\t\t\t$sql = \"UPDATE customer_notes SET cun_active=\".NO.\" WHERE cun_noteID=$noteID\";\n\t\t\tmysql_query($sql,$db);\n\t\t\t$this->error->mysql(__FILE__,__LINE__);\n\t\t}\n\t}", "function add_customer_note() {\n\n $user_id = (int) $_POST['user_id'];\n $note = wp_kses_post( trim( stripslashes( $_POST['note'] ) ) );\n\n if ( $user_id > 0 ) {\n $comment_id = WC_Crm_Customer_Details::add_order_note( $note, $user_id);\n\n echo '<li rel=\"' . esc_attr( $comment_id ) . '\" class=\"note\"><div class=\"note_content\">';\n echo wpautop( wptexturize( $note ) );\n echo '</div><p class=\"meta\"><a href=\"#\" class=\"delete_customer_note\">'.__( 'Delete note', 'woocommerce' ).'</a></p>';\n echo '</li>';\n }\n\n // Quit out\n die();\n }", "private function delete_note()\n\t{\n\t\t$imageID = int_escape($_POST[\"image_id\"]);\n\t\t$noteID = int_escape($_POST[\"note_id\"]);\n\n\t\t// validate parameters\n\t\tif(is_null($imageID) || !is_numeric($imageID))\n\t\t\treturn;\n\n\t\tif(is_null($noteID) || !is_numeric($noteID))\n\t\t\treturn;\n\n\t\tglobal $database;\n\t\t\n\t\t$database->execute(\"UPDATE notes \".\n\t\t\t\"SET enable = ? \".\n\t\t\t\"WHERE image_id = ? AND id = ?\", array(0, $imageID, $noteID));\n\t\t\n\t\tlog_info(\"notes\", \"Note deleted {$noteID} by {$user->name}\");\n\t}", "public function remove_extra_checkout_field( $fields ) {\n\t\tif ( $this->check_checkout_type_in_the_cart() ) {\n\t\t\tunset( $fields['billing']['billing_company'] );\n\t\t\tunset( $fields['billing']['billing_state'] );\n\t\t\tunset( $fields['billing']['billing_address_2'] );\n\t\t\tunset( $fields['billing']['billing_postcode'] );\n\t\t} else {\n\t\t\t$fields['billing']['billing_country']['required'] = false;\n\t\t\t$fields['billing']['billing_country']['default'] = 'Georgia';\n\t\t\tunset( $fields['billing']['billing_company'] );\n\t\t\tunset( $fields['billing']['billing_state'] );\n\t\t\tunset( $fields['billing']['billing_city'] );\n\t\t\tunset( $fields['billing']['billing_postcode'] );\n\t\t\t$fields['billing']['billing_address_1']['label'] = 'Address';\n\t\t\t$fields['billing']['billing_address_2']['label'] = 'Additional on address';\n\n\t\t}\n\t\t$fields['billing']['billing_phone']['required'] = true;\n\t\t$fields['billing']['billing_phone']['required'] = true;\n\t\t$fields['billing']['billing_phone']['placeholder'] = 'put your full phone number: e.g. +44357654321';\n\n\t\treturn $fields;\n\t}", "protected function DeleteExtra()\n\t{\t$course = new AdminCourse($this->details['cid']);\n\t\t$course->SetCourseDates();\n\t}", "public function remove_information($i_id=0)\r\n {}", "public function removeCustomer() {\n\t\tunset ( $this->heading ['customer'] );\n\t}", "private function nuke_notes() {\n\t\tglobal $database;\n\t\t$image_id = int_escape($_POST[\"image_id\"]);\n\t\t$database->execute(\"DELETE FROM notes WHERE image_id = ?\", array($image_id));\n\t\tlog_info(\"notes\", \"Notes deleted from {$image_id} by {$user->name}\");\n\t}", "function transfer_order_remove_textfield($form, &$form_state) {\n\n if ($form_state['location']['items'] > 1) {\n $form_state['location']['items']--;\n }\n\n $form_state['rebuild'] = TRUE;\n\n}", "public function removeLicenseDetails();", "public function unsetNote($index)\n {\n unset($this->note[$index]);\n }", "public function unsetNote($index)\n {\n unset($this->note[$index]);\n }", "function get_pdf_order_note( $order_id ) {\n\t\t\t\tglobal $woocommerce;\n\t\t\t\t$woocommerce_pdf_invoice_options = get_option( 'woocommerce_pdf_invoice_settings' );\n\t\t\t\t\n\t\t\t\tif (!$order_id) return;\t\n\t\t\t\t$order \t\t\t= new WC_Order( $order_id );\n\t\t\t\t// WooCommerce 3.0 compatibility \n \t\t$customer_note = is_callable( array( $order, 'get_customer_note' ) ) ? $order->get_customer_note() : $order->customer_note;\n\n\t\t\t\t$output = '';\n\t\t\t\t\n\t\t\t\tif( $customer_note ) {\n\t\t\t\t\t$output = '<h3>' . __('Note:', 'woocommerce-pdf-invoice') . '</h3>' . wpautop( wptexturize( $customer_note ) );\n\t\t\t\t\t$output = apply_filters( 'pdf_template_order_notes' , $output, $order_id );\n\t\t\t\t}\n\t\t\t\treturn $output;\n\t\t\t\t\t\n\t\t\t}", "public function remove_subscription_order_meta( $order_meta, $to_order, $from_order ) {\n\n\t\t// only when copying from an order to a subscription\n\t\tif ( $to_order instanceof \\WC_Subscription && $from_order instanceof \\WC_Order ) {\n\n\t\t\tforeach ( $order_meta as $index => $meta ) {\n\n\t\t\t\tif ( '_pip_invoice_number' === $meta['meta_key'] ) {\n\t\t\t\t\tunset( $order_meta[ $index ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $order_meta;\n\t}", "public function remove_subscription_order_meta_during_upgrade( $order_meta ) {\n\n\t\tif ( isset( $order_meta[ '_pip_invoice_number' ] ) ) {\n\t\t\tunset( $order_meta[ '_pip_invoice_number' ] );\n\t\t}\n\n\t\treturn $order_meta;\n\t}", "public static function unison($note, $key = null){ return $note; }", "function magazine_issue_remove() {\n delete_option('mic_current_issue');\n}", "function fdf_remove_item($fdf_document, $fieldname, $item)\n{\n}", "public function deleteReceiptContent(){\n $sql = \"UPDATE cash_sales_receipt_content SET status=0 WHERE spare_part='$this->sparePartId' AND receipt_number='$this->receiptNumber'\";\n mysqli_query($this->connect,$sql);\n }", "public function clear()\n {\n $this->footnotes = [];\n }", "public static function flushOrderDiscountsDetails(): void\n {\n self::$cache = null;\n }", "function deleteExtraFieldById($extraFieldId) {\r\n \r\n\t\t$this->update('DELETE FROM extra_field_settings WHERE extra_field_id = ?', array($extraFieldId));\r\n\t\treturn $this->update('DELETE FROM extra_fields WHERE extra_field_id = ?', array($extraFieldId));\r\n\t}" ]
[ "0.7560174", "0.5977772", "0.5934904", "0.57253414", "0.5699348", "0.5576368", "0.5547659", "0.54284894", "0.53816026", "0.53739643", "0.53391594", "0.5313357", "0.5310127", "0.5271364", "0.5270783", "0.52632576", "0.5248318", "0.5192737", "0.51687074", "0.51687074", "0.5157472", "0.513153", "0.51271826", "0.5121251", "0.51080644", "0.507845", "0.506318", "0.50615305", "0.50575614", "0.5046186" ]
0.7375164
1
Prevents duplicates and conflicting binds.
public function beforeCreate() { if ($existingRecord = $this->findBindingRecord()) { /* * Remove add-delete pairs */ if ($this->is_bind != $existingRecord->is_bind) { $existingRecord->deleteCancel(); return false; } /* * Skip repeating bindings */ return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rebind(){\n\t\t//connect with another account to search with if necessary\n\t\t$ad_dn=$this->_ad_username;\n\t\t$this->_bind = @ldap_bind($this->_conn,$ad_dn,$this->_ad_password);\n\t\tif ($this->_bind){ return true; }\n\t\treturn false;\n\t}", "public function allowsTrashedBindings()\n {\n return $this->withTrashedBindings;\n }", "private function repairBinding(array $bind): array\n {\n return array_map(function ($value) {\n if (preg_match(\"/^'.*'$/\", $value)) {\n return \" {$value} \";\n } else {\n return $value;\n }\n }, $bind);\n }", "public function testBind_exception()\n\t{\n\t\t$this->_instance->bind('foobar');\n\t}", "private function preventDuplicateDeletion(): void\n {\n EventManager::instance()->on('Model.beforeDelete', function ($event) {\n if ('Articles' === $event->getSubject()->getAlias()) {\n $event->stopPropagation();\n\n return false;\n }\n });\n }", "function unBind()\n\t{\n\t\tif ($this->ldap_debug) { error_log( __FILE__ . \" \" . __METHOD__ . \" \" . __LINE__ . \" Unbinding from LDAP Server \" . $this->ldapconfig['host']); }\n\t\tldap_unbind($this->ldapconn);\t\n\t}", "public function bindUsingCommonCredentials()\n {\n $bindDn = $this->config['commonBindDn'];\n $password = $this->config['commonBindPassword'];\n $this->bindUsingCredentials($bindDn, $password);\n }", "public function testParametersBoundedAlready()\n {\n $statement = new ParametersBoundedAlreadyStatement();\n $statement->setDriver(\n $this->getMock('\\Zend\\Db\\Adapter\\Driver\\Pdo\\Pdo', array(), array(), '', false)\n );\n $statement->initialize(\n new TestAsset\\CtorlessPdo(\n $pdoStatementMock = $this->getMock('\\PDOStatement', array('bindParam'))\n )\n );\n\n //bind param should be never called becaouse we set parametersBound = true in ParametersBounededAlteradStatement test asset\n $pdoStatementMock->expects($this->never())->method('bindParam');\n $statement->execute(array('dummy' => 'dummy'));\n }", "private function preventEntryDeletion(): void\n {\n EventManager::instance()->on('Model.beforeDelete', function ($event) {\n if ('Duplicates' === $event->getSubject()->getAlias()) {\n $event->stopPropagation();\n\n return false;\n }\n });\n }", "function bind( $from, $ignore=array() )\n\t{\n\t\t$result = parent::bind($from, $ignore);\n\t\t$dataBinds = $this->dataBindModel->getDataBinds();\n\t\tforeach($dataBinds as $dataBind)\n\t\t\tif(!$dataBind->onAfterBind( $this, $from ))\n\t\t\t\t$result = false;\n\t\treturn $result;\n\t}", "public function binds()\n {\n return [];\n }", "protected function bindPendingParams()\n {\n foreach ($this->_pendingParams as $name => $value) {\n $this->pdoStatement->bindValue($name, $value[0], $value[1]);\n }\n $this->_pendingParams = [];\n }", "public function haveBinds()\n {\n\t return !( empty( $this->values ) );\n }", "public function bind($a = null, $b = null)\n {\n throw new NotImplementedException(__METHOD__);\n }", "function anonymous_bind() {\r\n\t\t$this->bind_result = @ ldap_bind($this->_resource);\r\n\t\tif(!$this->bind_result && ldap_errno($this->_resource) == -1) {\r\n\t\t\t// we failed to connect to the server, attempt failover\r\n\t\t\tif($this->connect(true,false)) {\r\n\t\t\t\t// rebind with the new server if this fails then it doesn't matter'\r\n\t\t\t\t$this->bind_result = @ ldap_bind($this->_resource);\r\n\t\t\t\tif($this->bind_result) {\r\n\t\t\t\t\t// we bound successfully\r\n\t\t\t\t\t$this->_enactFailover($this->alternatehost, $this->host);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t// return whatever the final result was\r\n\t\treturn $this->bind_result;\r\n\t}", "public abstract function bind();", "public function resolveConflicts()\n {\n $this->preventConflicts();\n }", "public function testDuplicateStrategyOverrideWithUnmatchingTypes(): void\n {\n $configuration = (new Configuration(Configuration::DUPLICATE_STRATEGY_OVERRIDE_SAME_TYPE))\n ->addType(self::object('DuplicatedName', ['f' => 'String']))\n ->addType(self::input('DuplicatedName', ['f' => 'String']));\n\n $errors = $this->getValidator()->validate($configuration);\n $this->assertCount(1, $errors);\n $error = $errors->get(0);\n $this->assertEquals($error->getInvalidValue(), null);\n $this->assertMatchesRegularExpression('/Naming collision on name \"DuplicatedName\", found 2 types using it/', $error->getMessage());\n }", "protected function mapBindings()\n {\n //\n }", "public abstract function bindOn();", "public function hestia_fix_duplicate_widgets() {\n\t\tthemeisle_hestia_fix_duplicate_widgets();\n\t}", "public function getBinds(){\n\t\tif(count($this->binds) > 0){\n\t\t\treturn $this->binds;\n\t\t}\n\t\treturn array();\n\t}", "public function bind($array, $ignore = ''){\n\t\t\n\n\t\treturn parent::bind($array, $ignore);\n\t}", "public function bindIf(string $abstract, $concrete = null, bool $shared = false);", "function instance_allow_multiple() {\n return false;\n }", "public function testBindersInsertNewBinder()\n {\n }", "public function allowValueBinding()\n {\n return true;\n }", "private static function isValidDoubleWildcardBinding(string $binding)\n {\n return preg_match(\"-^.+$-\", $binding) === 1;\n }", "public function enforcesScopedBindings()\n {\n return (bool) ($this->action['scope_bindings'] ?? false);\n }", "public function canUseForMultishipping()\r\n {\r\n return false;\r\n }" ]
[ "0.5766514", "0.56451774", "0.5510635", "0.54002917", "0.5349439", "0.5314757", "0.52814615", "0.5277507", "0.52725154", "0.5249647", "0.5235207", "0.520422", "0.51970845", "0.51747024", "0.5136404", "0.5124586", "0.51073927", "0.5104942", "0.5100074", "0.5095061", "0.5081464", "0.505439", "0.5014914", "0.4990726", "0.49801147", "0.4959149", "0.49224067", "0.49182445", "0.48913738", "0.48695904" ]
0.5686067
1
Finds a duplicate binding record.
protected function findBindingRecord() { return self::where('master_type', $this->master_type) ->where('master_field', $this->master_field) ->where('slave_type', $this->slave_type) ->where('slave_id', $this->slave_id) ->where('session_key', $this->session_key) ->first() ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getDuplicateRecord($segment = null)\n {\n if ($segment === null) {\n $segment = $this->owner->URLSegment;\n }\n if (!$segment) {\n return false;\n }\n $class = get_class($this->owner);\n return $class::get()->exclude('ID', $this->owner->ID)->filter(\"URLSegment\", $segment)->first();\n }", "function checkDuplicate(PDO $db, string $name) : bool {\n $query = $db->prepare(\"SELECT `name` FROM `idols` WHERE `name` = :name;\");\n $query->bindParam(':name', $name);\n $query->execute();\n $return = $query->fetch();\n if (gettype($return) == 'array') {\n $return = 1;\n } return $return;\n}", "function checkResolvedElsewhere($base_record, $dup_record)\r\n\t{\r\n\t\t$res = 0;\r\n\t\t$base_pid = $base_record->pid;\r\n\t\t$dup_pid = $dup_record->pid;\r\n\r\n\r\n\t\t$report_dom = $this->getXML_DOM();\r\n\t\t$xpath = new DOMXPath($report_dom);\r\n\t\t$items = $xpath->query('/DuplicatesReport/duplicatesReportItem[@pid=\\''.$base_pid.'\\']'\r\n\t\t. '/duplicateItem[@pid=\\''.$dup_pid.'\\']');\r\n\t\t$item = $items->item(0);\r\n\t\t$duplicate = $item->getAttribute('duplicate');\r\n\t\t// if the item has been resolved in this report then no need to check whether it's been\r\n\t\t// resolved eleswhere.\r\n\t\tif (!empty($duplicate)) {\r\n\t\t\treturn $res;\r\n\t\t}\r\n\r\n\t\t// look for marked as non duplicate\r\n\t\t$history_res = History::searchOnPid($dup_pid, array('pre_detail' => '% Marked not duplicate of '\r\n\t\t. $base_pid));\r\n\t\tif (empty($history_res)) {\r\n\t\t\t$history_res = History::searchOnPid($dup_pid, array('pre_detail' => '% Resolved non-duplicate '\r\n\t\t\t. $base_pid));\r\n\t\t}\r\n\t\tif (!empty($history_res)) {\r\n\t\t\t$res = $this->setDuplicateXML($base_pid, $dup_pid, false);\r\n\t\t\tif ($res == 1) {\r\n\t\t\t\t$this->saveReport($this->xml_dom->saveXML());\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// look for marked as dupe\r\n\t\t\t$history_res = History::searchOnPid($dup_pid, array('pre_detail' => '% Marked Duplicate of '\r\n\t\t\t. $base_pid));\r\n\t\t\tif (empty($history_res)) {\r\n\t\t\t\t$history_res = History::searchOnPid($dup_pid, array('pre_detail' => '% Resolved duplicate '\r\n\t\t\t\t. $base_pid));\r\n\t\t\t}\r\n\t\t\tif (!empty($history_res)) {\r\n\t\t\t\t$res = $this->setDuplicateXML($base_pid, $dup_pid, true);\r\n\t\t\t\tif ($res == 1) {\r\n\t\t\t\t\t$this->saveReport($this->xml_dom->saveXML());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $res;\r\n\t}", "function checkDup($pdo, $sql, $userentry)\r\n{\r\n try {\r\n $stmt = $pdo->prepare($sql);\r\n $stmt->bindValue(1, $userentry);\r\n $stmt->execute();\r\n return $stmt->rowCount();\r\n }catch (PDOException $e)\r\n {\r\n exit();\r\n }\r\n}", "function checkDup($pdo, $sql, $userentry) {\r\n try {\r\n $stmt = $pdo->prepare($sql);\r\n $stmt->bindValue(1, $userentry);\r\n $stmt->execute();\r\n return $stmt->rowCount();\r\n }\r\n catch (PDOException $e) {\r\n exit();\r\n }\r\n}", "function getBind($name) {\n\t\t$out = false;\n\t\t\n\t\tif ($name && isset($this->binds[$name])) {\n\t\t\t$out = $name;\n\t\t}\n\t\t\n\t\treturn $out;\n\t}", "public function checkDuplicate()\n {\n //prepare the query using PDOStatment\n $stmt = $this->conn->prepare(\"SELECT * FROM \" . $this->tableName . \" WHERE manufacturer_name=:manufacturername\");\n \n //Bind Parameters using PDO Statment\n $stmt->bindParam(\":manufacturername\", $this->manufacturerName);\n \n //execute the PDOStatment\n $stmt -> execute();\n\n //fetchAll PDO Associative data from the PDOStatement which executes previously\n $result=$stmt->fetchAll(PDO::FETCH_ASSOC);\n\n //rowCount() predefine function\n if($stmt->rowCount()>0)\n {\n return 0;\n }\n else\n {\n return 1;\n }\n }", "public function DuplicateRecord(){\r\n\r\n //Create the INSERT query using all the parameter names and values of this object.\r\n $qCopy = \"INSERT INTO $this->tableName (\";\r\n\r\n for ($i = 0; $i< count($this->propertyNames); $i++){\r\n if (($this->propertyNames[$i] != $this->keyId_name) && ($this->propertyNames[$i] != \"TS\")){\r\n $qCopy .= $this->propertyNames[$i];\r\n $qCopy .= \",\";\r\n }\r\n }\r\n $qCopy = rtrim($qCopy,\",\") . \") VALUES (\";\r\n for ($i = 0; $i< count($this->propertyNames); $i++){\r\n if (($this->propertyNames[$i] != $this->keyId_name) && ($this->propertyNames[$i] != \"TS\")){\r\n $qCopy .= \"'\" . $this->propertyVals[$i] . \"'\";\r\n $qCopy .= \",\";\r\n }\r\n }\r\n $qCopy = rtrim($qCopy,\",\") . \");\";\r\n $rCopy = @mysql_query($qCopy,$this->dbconnection);\r\n\r\n //After the new duplicate record is created, get the primary key value and reinitialize\r\n //this object to the newly created record.\r\n $qMax = \"SELECT MAX($this->keyId_name) FROM $this->tableName;\";\r\n $rMax = @mysql_query($qMax,$this->dbconnection);\r\n $newId = @mysql_result($rMax,0,0);\r\n $this->Initialize($this->tableName,$newId,$this->keyId_name,$this->GetValue($this->fckeyname), $this->fckeyname);\r\n }", "public function isDuplicate(): bool\n {\n return ($this->packetFlags & 8) === 8;\n }", "function checkDuplicateItem()\r\n {\r\n $sql = \"select * from order1 where p_status=0 and Service_ID=:Service_ID and Cus_ID=:Cus_ID\";\r\n $args = [':Service_ID' => $this->Service_ID, ':Cus_ID' => $this->Cus_ID];\r\n $stmt = DB::run($sql, $args);\r\n $count = $stmt->rowCount();\r\n return $count;\r\n }", "function checkDuplicate($entry, $table, $field)\n {\n //echo $entry;\n $query = '\n SELECT\n *\n FROM\n Users\n WHERE\n email_address = \"'.mysql_real_escape_string ($entry).'\"\n OR email_address_2 = \"'.mysql_real_escape_string ($entry).'\"';\n $conn = new connection;\n $conn->makeConnection(/*local info*/);\n $match = mysql_query($query, $conn->connection) or die(mysql_error()); //execute\n //echo $match;\n $results = mysql_fetch_row($match);\n if($results[8] == $entry)\n {\n $this->_errors[$this->_counter] = 'There is already an entry for this e-mail address.';\n $this->_counter++;\n }\n else\n {\n return false;\n }\n }", "public function isDuplicate() {\r\n\t\treturn (1046 === $this->errorNumber);\r\n\t}", "public function record_exists(){\r\n\r\n $this->where( array( $this->id_field.'<>' => $this->{$this->id_field} ) );\r\n \r\n $sql = $this->build_select_sql().\" LIMIT 1\";\r\n\r\n if( $row = $this->fetch_data( $this->query( $sql ) ) ){\r\n $this->clear_clauses();\r\n return TRUE;\r\n }else{\r\n $this->clear_clauses();\r\n return FALSE;\r\n }\r\n }", "function checkDupe($clientEmail){\r\n $db = acmeConnect();\r\n $sql = 'SELECT clientEmail FROM clients WHERE clientEmail = :clientEmail';\r\n $stmt = $db->prepare($sql);\r\n $stmt->bindValue(':clientEmail', $clientEmail, PDO::PARAM_STR);\r\n \r\n $stmt->execute();\r\n $match = $stmt->fetch(PDO::FETCH_NUM);\r\n $stmt->closeCursor();\r\n \r\n if(empty($match)){\r\n return 0;\r\n } else {\r\n return 1;\r\n }\r\n}", "public function getBind($name)\n {\n if (isset($this->binds[$name])) {\n throw new \\OutOfBoundsException(sprintf(\"Form bind '%s' does not exist.\", $name));\n }\n\n $bind = $this->binds[$name];\n $bind->update();\n\n return $bind;\n }", "public function checkDuplicate(Address_entity $address) {\n \n // Check if the address exists by searching for it.\n $crit = new Address_criteria($this->CI->address_model->toData($address, FALSE));\n $result = $this->CI->address_model->search($crit, 0, 1);\n \n // If no address found, return the address parameter itself. Unset the ID (if set) so a new address will be created.\n if(empty($result)) {\n unset($address->id);\n return $address;\n }\n \n // Otherwise, return the found address.\n return reset($result);\n }", "function getDuplicate($arr) { //O(n) time and O(n) space\n $hash = [];\n\n foreach ($arr as $v) {\n if (array_key_exists($v, $hash)) {\n return $v;\n }\n $hash[$v] = true;\n }\n return false;\n}", "public function isduplicate($tbname,$fieldname,$fieldvalue) {\n $this->db2->from($tbname);\n $this->db2->where($fieldname, $fieldvalue);\n $query = $this->db2->get();\n if ($query->num_rows() > 0) {\n return true;\n } else {\n return false;\n }\n }", "protected function getHashRecord($uid) {\n\t\t$hashRecord = $this->database->exec_SELECTgetSingleRow(\n\t\t\t'*',\n\t\t\tDuplicateFinderService::HASH_TABLE,\n\t\t\t'uid=' . $uid\n\t\t);\n\t\treturn $hashRecord;\n\t}", "function dublicate($db, $id) {\n $sql = <<<SQLEND\n SELECT * FROM user WHERE id LIKE :id\nSQLEND;\n $stmt = $db->prepare($sql);\n $stmt->bindValue(':id', \"$id\", PDO::PARAM_STR);\n $stmt->execute();\n $row_count = $stmt->rowCount();\n if ($row_count == 1) return true; else return false;\n}", "function duplicateDocket($docketNumber)\n{\n\t$id = Docket::checkInDB($GLOBALS['db'], \"`Case`\", \"docket\", $docketNumber, \"\", \"\", \"id\");\n\t\t\n\t// if ID = 0, that means that this case is not in the DB\n\tif ($id==0)\n\t\treturn false;\n\telse\n\t\treturn true;\n}", "function rebind(){\n\t\t//connect with another account to search with if necessary\n\t\t$ad_dn=$this->_ad_username;\n\t\t$this->_bind = @ldap_bind($this->_conn,$ad_dn,$this->_ad_password);\n\t\tif ($this->_bind){ return true; }\n\t\treturn false;\n\t}", "function findOneMatchUid($uid)\n {\n /** @var \\Module\\Content\\Model\\Driver\\Mongo\\EntityPost $r */\n $r = $this->_query()->findOne([\n '_id' => $this->attainNextIdentifier($uid),\n ]);\n\n return ($r) ? $r : false;\n }", "public function fetchOne($statement, array $bindings = []);", "public function getBind()\n {\n return $this->getKey('Bind');\n }", "public function setDuplicateRecordSetId($duplicateRecordSetId)\n {\n $this->duplicateRecordSetId = $duplicateRecordSetId;\n return $this;\n }", "public function isDuplicateEntry() {\n return $this->getCode() == self::MYSQL_ERROR_DUP_ENTRY;\n }", "public function find($uid)\n\t{\n\t\t$this->db->select('x.*');\n\t\t$this->db->where($this->primary_key, $uid);\n\t\t$this->db->from($this->db_table.' x');\n\n\t\t$query = $this->db->get();\n\n\t\tif ($query->num_rows() === 1)\n\t\t{\n\t\t\t$this->populate($query->row());\n\t\t\treturn true;\n\t\t}\n\t\telseif ($query->num_rows() > 1)\n\t\t{\n\t\t\tthrow new Exception('Multiple matches exist for this ID, it is not unique.', 500);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// No results found\n\t\t\tthrow new exception('No record found with this ID', 404);\n\t\t}\n\t}", "function checkDuplicate( $sql )\n{\n\tglobal $common;\n\t\n\t$result = $common->m_db->query( $sql, __FILE__, __LINE__ );\n\t\t\t\n\tif( $common->m_db->numRows( $result ) == 0 )\n\t{\n\t\t$return = 0;\n\t}\n\telse \n\t{\n\t\t$row = $common->m_db->fetchRow( $result );\n\t\t$return = $row[0];\t\n\t}\n\t\n\treturn $return;\n\t\n}", "function checkDuplicate($name)\n\t\t{\n\t\t \tif(!file_exists('../data.txt')){\n \t\t\t\tprint(\"<p> We don't find the database </p>\");\n \t\t\t}\t \t\t\n\t\t \t$file = fopen(\"../data.txt\", \"r\");\n\t\t \t$file_pointer = fopen('../data.txt', 'r'); \n \t\t\n \t\tif(!$file_pointer){\n \t\t\tprint(\"some error\");\n \t\t\t\texit;\n \t\t\t}\n \t\t\t$info = array();\n\n \t\t\twhile(!feof ($file_pointer)){\n \t\t\t\t$line = fgets($file_pointer);\n \t\t\t\t\n \t\t\t\tif($name == $line){\n \t\t\t\t\t\n \t\t\t\t\treturn true;\n\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t\treturn false;\n\t }" ]
[ "0.5722559", "0.5479858", "0.52216214", "0.5114105", "0.5096024", "0.5090732", "0.5088097", "0.49396425", "0.4890047", "0.48112205", "0.47900948", "0.47571775", "0.475043", "0.47239238", "0.46975446", "0.4688184", "0.46677914", "0.46568426", "0.4652439", "0.465087", "0.46442702", "0.46432734", "0.46376446", "0.46375254", "0.4627105", "0.4621323", "0.46167958", "0.46053398", "0.45985293", "0.45936072" ]
0.6498618
0
Post endpoint for creating a domain in the domains table
public function create(Request $request) { // Get request json $domainJson = $request->get('params'); // Wrap create in a try catch block try { $newDomain = new Domains(); $newDomain->domain = $this->getDomainHostFromDomain($domainJson['domain']); $newDomain->description = $domainJson['description']; $newDomain->flag_status = 0; $newDomain->save(); // Delete all caches because all caches have inaccurate data, we can create one ones // When we query for them again Redis::flushAll(); } catch (\Exception $e) { return response('Error Saving Domain', 500); } return response()->json('Success'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createDomain(CreateDomainRequest $request)\n {\n $this->domainCreate($request, true);\n\n return redirect()->route('admin.domains')->with('success', __(':name has been created.', ['name' => str_replace(['http://', 'https://'], '', $request->input('name'))]));\n }", "protected function createDomainAction(): string\n {\n if ($data = $this->domainsRepository->storeDomain($this->requestParams['domain'] ?? '')) {\n return $this->response($data);\n }\n return $this->response(['success' => false], 400);\n }", "public function actionAddDomain(): Response\n {\n $this->license->addAuthorizedDomain(\n $this->requestService->post('domain')\n );\n\n Store::orderService()->saveOrderItem($this->license);\n\n return $this->redirect(\n $this->requestService->post('redirect', '/account')\n );\n }", "public function create(Request $request)\n {\n return \\Response::json(\n $this->domainService->create(\n $request->get('name')\n )\n );\n }", "public function actionCreate()\n {\n $form = new DomainForm();\n if ($form->load(Yii::$app->request->post()) && $form->validate()) {\n try {\n $model = $this->service->create($form);\n return $this->redirect(['view', 'id' => $model->id]);\n } catch (\\DomainException $e) {\n Yii::$app->errorHandler->logException($e);\n Yii::$app->session->setFlash('error', $e->getMessage());\n }\n }\n return $this->render('create', [\n 'model' => $form,\n ]);\n }", "public function actionCreate()\n {\n $request = Yii::app()->request;\n $notify = Yii::app()->notify;\n $domain = new TrackingDomain();\n $currentDomain = parse_url(Yii::app()->createAbsoluteUrl($this->route), PHP_URL_HOST);\n\n if ($request->isPostRequest && ($attributes = (array)$request->getPost($domain->modelName, array()))) {\n $domain->attributes = $attributes;\n $domain->customer_id = Yii::app()->customer->getId();\n if (!$domain->save()) {\n $notify->addError(Yii::t('app', 'Your form has a few errors, please fix them and try again!'));\n } else {\n $notify->addSuccess(Yii::t('app', 'Your form has been successfully saved!'));\n }\n\n Yii::app()->hooks->doAction('controller_action_save_data', $collection = new CAttributeCollection(array(\n 'controller'=> $this,\n 'success' => $notify->hasSuccess,\n 'domain' => $domain,\n )));\n\n if ($collection->success) {\n $this->redirect(array('tracking_domains/update', 'id' => $domain->domain_id));\n }\n }\n\n $this->setData(array(\n 'pageMetaTitle' => $this->data->pageMetaTitle . ' | '. Yii::t('tracking_domains', 'Create new tracking domain'),\n 'pageHeading' => Yii::t('tracking_domains', 'Create new tracking domain'),\n 'pageBreadcrumbs' => array(\n Yii::t('tracking_domains', 'Tracking domains') => $this->createUrl('tracking_domains/index'),\n Yii::t('app', 'Create new'),\n )\n ));\n\n $this->render('form', compact('domain', 'currentDomain'));\n }", "public function store(Request $request,$domainId){\n //return $this->respondWithItem($result);\n if($request->has('start_date')){\n $insert['start_date'] = Carbon::parse( $request->input('start_date'));\n }\n if($request->has('end_date')){\n $insert['end_date'] = Carbon::parse( $request->input('end_date'));\n }\n if($request->has('all_day')){\n $insert['all_day'] = $request->input('all_day');\n }\n if($request->has('day_name')){\n $insert['day_name'] = $request->input('day_name');\n }\n if($request->has('priority')){\n $insert['priority'] = $request->input('priority');\n }\n\n if($request->has('role_id')){\n $insert['role_id'] = $request->input('role_id');\n }\n DB::table('important_day')->insert($insert);\n $data['result'] = true;\n return $this->respondWithItem($data);\n }", "public function addDomain($params= ['domain-name'=>'learncloud.com','years'=>'1','ns'=>'ns1.domain.com','ns'=>'ns2.domain.com','customer-id'=>'17579075','reg-contact-id'=>'71548132','admin-contact-id'=>'71548132','tech-contact-id'=>'71548132','billing-contact-id'=>'71548132','invoice-option'=>'KeepInvoice']){\n\n\t\t return $this->callResellerClubEndpoint('domains/register', 'POST' , $params);\n\n\t}", "public function store(Request $request)\n {\n $id = $request->domain;\n $domainName = DB::table('domains')\n ->find($id)\n ->name;\n try {\n $domainData = $this->checkDomain($domainName);\n } catch (RequestException | ConnectionException $e) {\n Log::notice($e->getMessage());\n flash($e->getMessage())->error();\n return redirect()->route('domains.show', $id);\n }\n\n DB::table('domain_checks')->insert([\n 'domain_id' => $id,\n 'status_code' => $domainData['statusCode'],\n 'h1' => $domainData['h1'],\n 'keywords' => $domainData['keywords'],\n 'description' => $domainData['description'],\n 'created_at' => Carbon::now()->toDateTimeString(),\n 'updated_at' => Carbon::now()->toDateTimeString()\n ]);\n flash('Website has been checked!');\n return redirect()->route('domains.show', $id);\n }", "public function createDomain($params = [])\n {\n return $this->api->apiRequest('/domains', $params, 'POST');\n }", "public function createDomain($domain, /* Added by DD - 16/05/2015 : One parametr for new API to create Domain*/$create = true/* END */,$timezone = null, $language = null, $filtermx = null, $spamTag = null, $spamFolder = null, $spamLevel = null) { \n\t\t/*$compile = \"\";\n\t\t$compile .= \" domain=\\\"\".$domain.\"\\\"\";\n\t\tif(!empty($timezone)) $compile .= \" timezone=\\\"\".$timezone.\"\\\"\";\n\t\tif(!empty($language)) $compile .= \" language=\\\"\".$language.\"\\\"\";\n\t\tif(!empty($filtermx)) $compile .= \" filtermx=\\\"\".$filtermx.\"\\\"\";\n\t\tif(!empty($spamTag)) $compile .= \" spam_tag=\\\"\".$spamTag.\"\\\"\";\n\t\tif(!empty($spamFolder)) $compile .= \" spam_folder=\\\"\".$spamFolder.\"\\\"\";\n if(!empty($spamLevel)) $compile .= \" spam_level=\\\"\".$spamLevel.\"\\\"\";\n return $this->_processRequest (\"create_domain\", $compile); */\n /* END */\n \n /* Added by DD - 16/05/2015 : Array object to create domain (For new api) */\n $compile = array(\"attributes\"=>new ArrayObject(),\"domain\"=>$domain,\"create_only\"=>$create,\"credentials\"=>array(\"user\"=>$this->username,\"password\"=>$this->password));\n \n /* Check if domain already exists */\n $getParams = array(\"credentials\"=>array(\"user\"=>$this->username,\"password\"=>$this->password),\"domain\"=>$domain); \n $result = $this->_processRequest (\"get_domain\", $getParams); \n if(!$result[\"is_success\"])\n {\n\t\t return $this->_processRequest (\"change_domain\", $compile);\n }\n else\n {\n $result=Array(\n \"is_success\" => \"0\",\n \"response_code\" => \"7\",\n \"response_text\" => \"This domain already exists.\"\n );\n return $result;\n }\n /* END */\n\t}", "function registrar_api_create_domain($domain_name, $years, $registrant,\n $tech, $admin, $auxbilling, $nameservers = NULL) {\n\n $contact = _registrar_api_convert_contacts(\n $registrant, $tech, $admin, $auxbilling);\n\n return _registrar_api_method('create_domain',\n $domain_name, $years, $contact['registrant'], $contact['tech'],\n $contact['admin'], $contact['auxbilling'], $nameservers\n );\n}", "public function postDomains()\n {\n return [\n 'method' => 'POST',\n 'path' => 'domains',\n 'jsonKey' => 'domains',\n 'params' => [\n 'domains' => $this->params->domainsJson(),\n ],\n ];\n }", "public function addDomain($domain) {\n $insertQuery = \"INSERT INTO optin_domain\".\n \" (domain)\".\n \" VALUES ('\".self::$db->quote($domain).\"')\";\n\n self::$db->query($insertQuery);\n return new AjaxResult(true, \"Data has been added to database!\");\n }", "public function store(Request $request, string $domainName)\n {\n // apply basic form validation\n $this->validate($request, [\n 'local' => 'required|max:64',\n 'destination' => 'required|min:2|max:255|email'\n ]);\n\n $domain = Domain::findByNameOrFail($domainName);\n\n $alias = new Alias();\n $alias->domain = $domain->name;\n $alias->local = $request->input('local');\n $alias->destination = $request->input('destination');\n $alias->save();\n\n if ($request->has('create-noreg') && $request->input('create-noreg')) {\n $count = NoregAddress::where('local', $request->input('local'))\n ->where('domain', $domain->name)\n ->count()\n ;\n\n // avoid duplicate noreg entries\n if ($count < 1) {\n $noreg = new NoregAddress();\n $noreg->local = $request->input('local');\n $noreg->domain = $domain->name;\n $noreg->save();\n }\n }\n\n return redirect()->route('domain.alias.index', [\n 'domain' => $domain->name\n ]);\n }", "public function store(CreateBadDomain $request)\n {\n $domain = new BadDomain;\n\n $domain->fill( $request->all() );\n $domain->save();\n return back();\n }", "public function create_domain($domain_name, $opt = null)\n\t{\n\t\tif (!$opt) $opt = array();\n\t\t$opt['DomainName'] = $domain_name;\n\t\t\n\t\treturn $this->authenticate('CreateDomain', $opt);\n\t}", "public function register_domain( $domain , $data )\n\t{\n\n\t}", "public function humsciAddDomain() {\n\n $username = $this->askQuestion('Acquia Username. Usually an email', '', TRUE);\n $password = $this->askHidden('Acquia Password');\n\n $new_domains = [];\n while ($domain = $this->askQuestion('Domain to add. Leave empty when done')) {\n while (empty($environment = $this->askChoice('Which environment', [\n 'dev',\n 'test',\n 'prod',\n ], ''))) {\n continue;\n }\n $url = \"{$this->apiEndpoint}/sites/devcloud:swshumsci/envs/$environment/domains/$domain.json\";\n\n $this->say($url);\n\n $curl = curl_init();\n curl_setopt($curl, CURLOPT_URL, $url);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($curl, CURLOPT_USERPWD, \"$username:$password\");\n curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n curl_setopt($curl, CURLOPT_POST, 1);\n $output = curl_exec($curl);\n curl_getinfo($curl);\n curl_close($curl);\n $this->say($output);\n\n $new_domains[$environment][] = $domain;\n }\n\n foreach ($new_domains as $environment => $domains) {\n $this->humsciLetsEncryptAdd($environment, ['domains' => $domains]);\n }\n }", "public function insert($domain) {\n // check if this is a valid domain\n if ($this->validate($domain)) {\n // perform insert here\n try {\n $query=$this->connection->prepare(\"INSERT INTO `domains` (dom_name, dom_reg_id, dom_reg_date, dom_exp_date, dom_comment)\n VALUES (:dom_name, :dom_reg_id, :dom_reg_date,\n :dom_exp_date, :dom_comment)\");\n $query->execute(array( 'dom_name' => $domain['dom_name'],\n 'dom_reg_id' => (int)$domain['dom_reg_id'],\n 'dom_reg_date' => $domain['dom_reg_date'],\n 'dom_exp_date' => $domain['dom_exp_date'],\n 'dom_comment' => $domain['dom_comment'],\n ));\n $result = true;\n }\n catch (PDOException $e)\n {\n trigger_error('Domains: error inserting domain'+$e);\n $result = false;\n } \n } else\n {\n trigger_error('Domains: trying to insert invalid domain data.');\n $result=false;\n }\n // let's reload just in case to reflect changes\n $this->domains = $this->fetchAll();\n return $result;\n }", "public function store()\n\t{\n\t\t$rules = [\n\t\t'description' => 'min:2',\n\t\t'name' => 'required|min:2|max:145',\n\t\t'abn' => 'required|min:2|max:145',\n\t\t'phone' => 'required|min:2|max:145',\n\t\t'email_id' => 'required|email|min:5|max:145|unique:companies',\n\t\t//'recaptcha_response_field' => 'required|recaptcha',\n\t\t];\n\n\t\t$this->validate($this->request, $rules);\n\t\t// if validates\n\t\t$request = $this->request->all();\n\t\t$request['company_database_name'] = $this->createDomain($request['name']);\n\t\t$created = $this->agency->add($request);\n\t\tif($created)\n\t\t\tFlash::success('Agency has been registered successfully. Please check your email for further set up details.');\n\t\treturn redirect()->route('frontend.agency');\n\t}", "function stregistry_RegisterDomain($params)\n{\n\t// init connection\n\tif (($status = __initConnectionAndAuthorize($params)) !== true) {\n\t\treturn __errorArray($status);\n\t}\n\n\t$domain = new Domain($params['domainname']);\n\n\t// create domain contacts\n\t$contactIds = array();\n\tforeach (array('registrant', 'admin', 'tech', 'billing') as $contactType) {\n\t\t$contact = new Contact();\n\t\t$contact->setEmail($params['email'])\n\t\t\t\t->setPhoneNumber($params['phonenumberformatted'] ?: '')\n\t\t\t\t->setName($params['fullname'])\n\t\t\t\t->setOrganization($params['companyname'])\n\t\t\t\t->setAddress($params['address1'], $params['address1'] ?: '')\n\t\t\t\t->setCity($params['city'])\n\t\t\t\t->setState($params['fullstate'])\n\t\t\t\t->setPostalCode($params['postcode'])\n\t\t\t\t->setCountryCode($params['countrycode']);\n\t\t\n\t\t$json = STRegistry::Contacts()->create($contact);\n\t\tif (!ResponseHelper::isSuccess($json)) {\n\t\t\treturn __errorArray(ResponseHelper::fromJSON($json)->message);\n\t\t}\n\t\t$contactIds[$contactType] = ResponseHelper::fromJSON($json, 'creData')->result['id'];\n\t}\n\t$domain->setContacts($contactIds['registrant'], $contactIds['admin'], $contactIds['tech'], $contactIds['billing']);\n\n\tif ($params['idprotection']) {\n\t\t$domain->setPrivacyContacts(STRegistryPrivacyContact::getRegistrantId(), STRegistryPrivacyContact::getAdminId(), STRegistryPrivacyContact::getTechId(), STRegistryPrivacyContact::getBillingId());\n\t}\n\t// add nameservers\n\tforeach (array('ns1', 'ns2', 'ns3', 'ns4', 'ns5') as $nsKey) {\n\t\tif (!empty($params[$nsKey])) {\n\t\t\t$domain->addNameServer($params[$nsKey]);\n\t\t}\n\t}\n\n\t// creating domain\n\t$json = STRegistry::Domains()->create($domain, $params['regperiod']);\n\tif (!ResponseHelper::isSuccess($json)) {\n\t\treturn __errorArray(ResponseHelper::fromJSON($json)->message);\n\t}\n\n\treturn 'success';\n}", "public function new_add_request(Request $request)\n {\n \n $newDomainName = $request->get('new_domain_name');\n $newDomainName = Domain::where('name', $newDomainName)->get()->first()->name;\n return $this->add_new($newDomainName);\n }", "public function updateDomain(Request $request) {\n $checker = BackLinkChecker::findOrFail($request['id']);\n $checker->domains = $request['domain_name'];\n $checker->save();\n return response()->json([\n 'type' => 'success',\n 'message' => 'Domain Updated'\n ]);\n }", "public function created(Domain $domain)\n {\n $domain->site->provision();\n\n $domain->provision();\n }", "public function create()\n {\n $domain = domain::all();\n\n return view('admin.adduser.add',compact('domain'));\n }", "public function registerAction() {\n\t\t$domainID = $this->getRequest ()->getParam('id');\n\t\t$action = $this->getRequest ()->getParam('do');\n\n\t\t// Check if the request comes from the owner of the domain\n\t\tif(!Domains::isOwner($domainID, $this->customer['customer_id'])){\n\t\t\t$this->_helper->redirector ( 'list', 'domains', 'default', array ('mex' => 'A problem has been occurred during the request.', 'status' => 'danger' ) );\t\n\t\t}\n\t\t\n\t\t// Get the domain name\n\t\t$domain = Domains::getDomainName($domainID);\n\t\t\n\t\tif(empty($domain)){\n\t\t\t$this->_helper->redirector ( 'list', 'domains', 'default', array ('mex' => 'A problem has been occurred during the request.', 'status' => 'danger' ) );\n\t\t}\n\t\t\n\t\tswitch ($action) {\n\t\t\tcase 'lockDomain':\n\t\t\t\tDomainsTasks::AddTask($domain, 'lockDomain');\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase 'unlockDomain':\n\t\t\t\tDomainsTasks::AddTask($domain, 'unlockDomain');\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase 'updateDomain':\n\t\t\t\tDomainsTasks::AddTask($domain, 'updateDomain');\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tdefault:\n\t\t\t\t$this->_helper->redirector ( 'list', 'domains', 'default', array ('mex' => 'A problem has been occurred during the request.', 'status' => 'danger' ) );\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t$this->_helper->redirector ( 'edit', 'domains', 'default', array ('id' => $domainID, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success' ) );\n\t}", "public function createRequestOnDomainRegFromFree($domain) {\n\t\t\n\t}", "function bandhead_add()\r\n\r\n\r\n {\r\n\r\n if ($this->request->is('post')) {\r\n\r\n\r\n \r\n\r\n\r\n $this->loadModel('Domain');\r\n\r\n\r\n $this->Domain->set($this->request->data);\r\n\r\n\r\n $this->request->data = Sanitize::clean($this->request->data, array('encode' => false));\r\n\r\n\r\n \r\n\r\n\r\n if ($this->Domain->validates()) {\r\n\r\n\r\n //pr($this->data); die;\r\n\r\n\r\n if ($this->Domain->save($this->request->data, false)) {\r\n\r\n\r\n $this->Session->write('flash', array(ADD_RECORD, 'success'));\r\n\r\n\r\n\r\n\r\n\r\n } else {\r\n\r\n\r\n $this->Session->write('flash', array(ERROR_MSG, 'failure'));\r\n\r\n\r\n }\r\n\r\n\r\n $this->redirect(array('controller' => 'Domains', 'action' => 'index'));\r\n\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n\r\n }", "function printCreateDomainForm() {\r\n\t\tprint '<form method=\"POST\" action=\"#\">';\r\n\t\tprint 'Domain:';\r\n\t\tprint '&nbsp;';\r\n\t\tprint '<input type=\"text\" size=\"15\" name=\"domain\">';\r\n\t\tprint '&nbsp;';\r\n\t\tprint '<input type=\"submit\" value=\"Create\">';\r\n\t\tprint '</form>';\r\n\t}" ]
[ "0.7542626", "0.7195831", "0.70131683", "0.6876421", "0.6848847", "0.6781173", "0.6554899", "0.6477731", "0.6460092", "0.6441399", "0.63723636", "0.6368174", "0.6335907", "0.6326886", "0.63000184", "0.6271049", "0.6186733", "0.61722267", "0.6157426", "0.6106016", "0.6088385", "0.6081006", "0.60496455", "0.59607595", "0.58970094", "0.5889537", "0.5860729", "0.5836606", "0.5813633", "0.57831484" ]
0.72349524
1
Validation endpoint to check if Domain is unique
public function validateDomain(Request $request) { // Get request parameters $params = $request->get('params'); $domainName = $params['domain']; // Parse the string domain into parts, looking for just the host $domainHost = $this->getDomainHostFromDomain($domainName); // In case domain string is not valid, return error with message if (!$domainHost) { return response('This is not a valid domain.', 401); } // Check DB if domain already exists $domains = Domains::where('domain', $domainHost)->get(); // Instantiate variable describing if domain is good to create/unique $isValid = count($domains) < 1; // Return response return response()->json($isValid); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function validate_domain() {\n if (isset($this->initial_data[\"domain\"])) {\n # Ensure it is a validate hostname\n if (is_hostname($this->initial_data[\"domain\"])) {\n $this->validated_data[\"domain\"] = $this->initial_data['domain'];\n } else {\n $this->errors[] = APIResponse\\get(2047);\n }\n } else {\n $this->errors[] = APIResponse\\get(2008);\n }\n }", "public function validateDomainApi()\n {\n $this->validate($this->request, [\n 'host' => 'required|string',\n ]);\n\n $failReason = '';\n\n try {\n $host = parse_url($this->request->get('host'), PHP_URL_HOST);\n $dns = dns_get_record($host ?? $this->request->get('host'));\n } catch (Exception $e) {\n $dns = [];\n }\n\n $recordWithIp = Arr::first($dns, function ($record) {\n return isset($record['ip']);\n });\n if (\n empty($dns) ||\n (isset($recordWithIp) &&\n $recordWithIp['ip'] !== $this->getServerIp())\n ) {\n $failReason = 'dnsNotSetup';\n }\n\n $http = new HttpClient(['verify' => false]);\n $host = trim($this->request->get('host'), '/');\n try {\n return $http->get(\"$host/\" . self::VALIDATE_CUSTOM_DOMAIN_PATH);\n } catch (RequestException | ConnectException $e) {\n $failReason = 'serverNotConfigured';\n }\n\n return $this->error(__('Could not validate domain.'), [], 422, [\n 'failReason' => $failReason,\n ]);\n }", "public function validateDomain()\n {\n return $this->success(['result' => 'connected']);\n }", "function is_valid_domain_name(){\n // add more `domain-name`\n $domains = array('localhost','192.168.43.147','kamal');\n if (in_array($_SERVER['HTTP_HOST'], $domains)){\n // $domain = $_SERVER['HTTP_HOST'];\n return true;\n }\n else{\n // $domain = 'localhost';\n return false;\n }\n}", "public function testAddValidDomain() {\n\t\t// the success message that the domain is white-listed, would be triggered exactly once\n\t\t$this->logger\n\t\t\t->expects($this->once())\n\t\t\t->method('debug');\n\n\t\t$this->config\n\t\t\t->expects($this->once())\n\t\t\t->method(\"setUserValue\");\n\n\t\t$response = $this->corsController->addDomain(\"http://www.test1.com\");\n\n\t\t$expectedResponse = new JSONResponse(['domains' => ['http://www.test.com', 'http://www.test1.com']]);\n\n\t\t$this->assertEquals($response, $expectedResponse);\n\t}", "function registrar_api_check_domain($domain) {\n $domain_results = registrar_api_check_domains(array($domain));\n if ($domain_results[$domain]['Available'] == \"true\") {\n return TRUE;\n }\n return FALSE;\n}", "public function check(CheckDomain $request)\n {\n $domains = Domain::withTrashed()->where('domain', $request->domain)->get();\n if (count($domains) > 0) {\n return response()->json(['status' => 200, 'message' => 'Domain already exists.']);\n } else {\n return response()->json(['status' => 404, 'message' => 'Available']);\n }\n }", "public function checkdomain() {\r\n $this->layout = null;\r\n $this->autoRender = false;\r\n $status = 0;\r\n $data = array();\r\n try {\r\n // grab the post data\r\n $data['User']['email'] = $_POST['data']['User']['email'];;\r\n $data['User']['school_id'] = $_POST['school_id'];\r\n $data['User']['school_status'] = $_POST['school_status'];\r\n $json = $this->validate_email_domain($data);\r\n $results = json_decode($json);\r\n echo $results->result;\r\n } catch (Exception $e) {\r\n $this->log(\"{UsersController#checkdomain} - An exception was thrown: \" . $e->getMessage());\r\n echo \"false\";\r\n exit();\r\n }\r\n }", "function VerifyUniqueEmail($strEmail){\n if(!Database::Get()->GetUserDataByEmail($strEmail)){\n $strDomain = substr($strEmail, strpos($strEmail, \"@\") + 1);\n if(!fopen(\"http://www.$strDomain\",'r') && !Utility::Get()->GetURLHeaderHTTP($strDomain)){//check for a valid URL\n $this->arrValidationErrors['duplicate'] = array('duplicate'=> 'This email domain seems to be invalid. Please check it and try again.');\n DisplayMessages::Get()->AddUserMSG( 'This email domain seems to be invalid. Please check it and try again.',1);\n return FALSE;\n }\n return TRUE;\n }\n $this->arrValidationErrors['duplicate'] = array('duplicate'=> ' [This email is invalid, banned, or otherwise unavailable. Please try again.].');\n DisplayMessages::Get()->AddUserMSG( ' [This email is invalid, banned, or otherwise unavailable. Please try again.].',1);\n return FALSE;\n }", "public function testAddInvalidDomain() {\n\t\t// the success message that the domain is white-listed, wouldn't be triggered\n\t\t$this->logger\n\t\t\t->expects($this->never())\n\t\t\t->method('debug');\n\n\t\t$this->config\n\t\t\t->expects($this->never())\n\t\t\t->method(\"setUserValue\");\n\n\t\t$this->l10n->method('t')\n\t\t\t->willReturnCallback(function ($a) {\n\t\t\t\treturn $a;\n\t\t\t});\n\n\t\t$response = $this->corsController->addDomain(\"http://non-valid domain\");\n\n\t\t$responseData = $response->getData();\n\n\t\t$this->assertArrayHasKey('message', $responseData);\n\t\t$this->assertEquals(\"'%s' is not a valid domain\", $responseData['message']);\n\t}", "private function checkDomainExists($domain = '')\n\t{\n\t\t$i = 1;\n\t\t$exists = Agency::where('company_database_name', $domain)->first();\n\t\t$new_domain = $domain;\n\t\twhile ($exists) {\n\t\t\t$new_domain = $domain . $i;\n\t\t\t$exists = Agency::where('company_database_name', $new_domain)->first();\n\t\t\t$i++;\n\t\t}\n\t\treturn $new_domain;\n\t}", "private function checkDomainExists($domain = '')\n\t{\n\t\t$i = 1;\n\t\t$exists = Agency::where('company_database_name', $domain)->first();\n\t\t$new_domain = $domain;\n\t\twhile ($exists) {\n\t\t\t$new_domain = $domain . $i;\n\t\t\t$exists = Agency::where('company_database_name', $new_domain)->first();\n\t\t\t$i++;\n\t\t}\n\t\treturn $new_domain;\n\t}", "public function action_emailunique() {\n $validation = Validation::factory($_POST);\n $validation->rule('email', 'not_empty');\n $validation->rule('email', 'email');\n $validation->rule('email', 'email_unique');\n if ($validation->check()) {\n $res = 1;\n } else {\n $res = 0;\n }\n //$user = new Model_User();\n //$res = $user->email_unique($email);\n echo json_encode(array('result' => $res));\n }", "public function checkEmailIsUnique($email);", "public function uniqueValidation(Request $request)\n {\n try {\n return $this->performUniqueValidationOfProject($request);\n } catch (Exception $e) {\n /*$response = handleExceptionAndLog($e, 'Customer', $this->account, $request, 'uniqueValidation() ');\n return response()->json($response);*/\n return response()->json($e);\n }\n }", "public function testIsUnique()\n {\n $this->Article->validate('id', ['rule'=> 'isUnique']);\n $article = $this->Article->new();\n $article->id = 1;\n $this->assertTrue($this->Article->validates($article));\n\n $article = $this->Article->new();\n $article->id = 1000;\n $this->assertFalse($this->Article->validates($article));\n \n $this->Article->validate('id', ['rule'=> ['isUnique',['id','title']]]);\n $article = $this->Article->new();\n $article->id = 1000;\n $article->title = 'Article #1';\n $this->assertFalse($this->Article->validates($article));\n }", "public function validate_domain($domain)\n {\n clearos_profile(__METHOD__, __LINE__);\n\n if (! Network_Utils::is_valid_domain($domain, TRUE))\n return lang('network_internet_domain_invalid');\n }", "function test_domain($domain) {\n\t// reg expression used to check if the domain or ip address is valid\n\t$domexprcheck\t= \"/^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$/i\";\n\t$ipexpcheck\t\t= \"/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i\";\n\nreturn (preg_match($domexprcheck, $domain) == true || preg_match($ipexpcheck, $domain) == true) ? true : false; }", "public function validate_host() {\n if (isset($this->initial_data[\"host\"])) {\n # Ensure it is a valid hostname\n if (is_hostname($this->initial_data[\"host\"])) {\n $this->validated_data[\"host\"] = $this->initial_data['host'];\n } else {\n $this->errors[] = APIResponse\\get(2046);\n }\n } else {\n $this->errors[] = APIResponse\\get(2007);\n }\n }", "protected function domainAllowed()\n {\n $allowedDomains = Config::get('sudosu.domains');\n\n // Split out the request url into the domain-name and port\n $requestData = parse_url(Request::url());\n $domain = $requestData['host'];\n $port = isset($requestData['port']) ? $requestData['port'] : null;\n\n // Create a regex based on the domains\n foreach($allowedDomains as $allowedDomain) {\n $regex = \"/$allowedDomain$/\";\n\n // Replace * with all chars\n $regex = str_replace('*', '(.*)', $regex);\n\n // Check the regex agains the domain.\n if ($port && preg_match($regex, \"$domain:$port\") || (!$port && preg_match($regex, $domain))) {\n return true;\n }\n }\n\n return false;\n }", "public function validateUser(Request $request)\n {\n $response = Validator::make($request->all(), [\n 'email' => 'unique:users|email',\n ]);\n\n $route = url( ($response->fails()) ? '/youExist' : 'https://pro.creativemarket.com/sign-up' );\n\n return $route;\n }", "public function validate()\n {\n $url = self::getHostUrl($this->url);\n $site_url = self::getHostUrl();\n if ($site_url === null) {\n $site_url = self::getHostUrl(site_url('url'));\n }\n if ($url === $site_url || !$url) {\n return false;\n }\n return true;\n }", "public function validate_unique($value, $input, $args);", "public function emailParameterShouldBeUnique()\n {\n // Arrange...\n $this->login();\n\n // Act...\n $this->json('put', \"users/{$this->user->id}\", array_merge($this->input, [\n 'email' => $this->user->email\n ]));\n\n // Assert...\n $this->seeError('validation_failed', Response::HTTP_UNPROCESSABLE_ENTITY);\n }", "public function ensureUniqueness(): static;", "public function isValid()\n {\n return parent::isValid() && $this->isHostnameSafe();\n }", "public function isOnCorrectDomain()\n {\n return array_get($this->response, 'correct_domain');\n }", "public function validate_domain( $domain )\r\n\t{\r\n\t\tif ( ! empty( $domain ) ) {\r\n\t\t\t$domain = esc_url_raw( $domain, array( 'http', 'https' ) );\r\n\t\t\tif ( '' == $domain ) {\r\n\t\t\t\tadd_settings_error( $this->_name, $this->_tag, 'invalid url' );\r\n\t\t\t} else {\r\n\t\t\t\t$this->_domain = trailingslashit( esc_url_raw( $domain, array( 'http', 'https' ) ) );\r\n\t\t\t\tupdate_option( $this->_tag, $this->_domain );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tdelete_option( $this->tag );\r\n\t\t}\r\n\t}", "function isDomainAvailible($domain)\n{\n if (!filter_var($domain, FILTER_VALIDATE_URL)) {\n return false;\n }\n //initialize curl\n $curlInit = curl_init($domain);\n curl_setopt($curlInit, CURLOPT_CONNECTTIMEOUT, 10);\n curl_setopt($curlInit, CURLOPT_HEADER, true);\n curl_setopt($curlInit, CURLOPT_NOBODY, true);\n curl_setopt($curlInit, CURLOPT_RETURNTRANSFER, true);\n //get answer\n $response = curl_exec($curlInit);\n curl_close($curlInit);\n\n if ($response) return true;\n return false;\n}", "public function checkDomainAction($domain)\n {\n try {\n $whoIs = new DomainLookup( new Socket() );\n $result = $whoIs->lookup($domain);\n } catch (\\Exception $e) {\n return self::failureResponse($e->getMessage());\n }\n\n $registered = $this->isWhoIsEntryFound($result);\n $message = $registered ? 'Domain seems to be registered' : 'Domain seems to be free';\n\n return self::successResponse(\n $message,\n array(\n 'registered' => $registered,\n 'whois' => utf8_encode($result),\n )\n );\n }" ]
[ "0.73087037", "0.69799167", "0.6803335", "0.622838", "0.62189144", "0.6184618", "0.6183623", "0.61706185", "0.6100188", "0.604301", "0.6040408", "0.6040408", "0.6013585", "0.5939671", "0.593935", "0.5924888", "0.59231263", "0.5903818", "0.58436424", "0.5830441", "0.5808731", "0.58078396", "0.57918596", "0.5785071", "0.57475936", "0.5717054", "0.57160085", "0.5712287", "0.5676115", "0.5661663" ]
0.7368561
0
Builds the array of routes to set as global variable
public static function build_routes() { $routes = array(); $query = new WP_Query(array( 'post_type' => 'any', 'post_status' => 'publish', 'posts_per_page' => -1 )); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $routes[] = array( 'id' => get_the_ID(), 'type' => get_post_type(), 'slug' => basename(get_permalink()) ); } } wp_reset_postdata(); return $routes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function setRoutes(): void\n {\n $routesClassRoot = new \\HeliumConfig\\Routes;\n $routesClass = new ReflectionClass($routesClassRoot);\n $routes = [];\n foreach ($routesClass->getConstants() as $controller => $actions) {\n foreach ($actions as $action => $isVisible) {\n $key = $controller . DS . $action;\n $routes[$key] = [\n 'controller' => $controller,\n 'action' => $action,\n 'visible' => $isVisible\n ];\n }\n }\n\n $this->routes = $routes;\n }", "protected function routes(): array\n {\n return [];\n }", "abstract public function routes(): array;", "public static function getRoutes()\n {\n //You need to follow this pattern to add new URLS\n //You should improve this function by making functions to create routes in a factory. I will look for this when grading\n\n //I also use object for the route because it has data and it's easier to access.\n\n $routes[] = self::create('GET','show','homepage','homepageController','show');\n $routes[] = self::create('POST','create','homepage','homepageController','create');\n $routes[] = self::create('GET','show','tasks','tasksController','show');\n $routes[] = self::create('GET','all','tasks','tasksController','all');\n $routes[] = self::create('GET','all','accounts','accountsController','all');\n $routes[] = self::create('GET','show','accounts','accountsController','show');\n $routes[] = self::create('POST','login','accounts','accountsController','login');\n $routes[] = self::create('POST','delete','tasks','tasksController','delete');\n $routes[] = self::create('POST','delete','accounts','accountsController','delete');\n $routes[] = self::create('GET','edit','accounts','accountsController','edit');\n $routes[] = self::create('POST','save','accounts','accountsController','save');\n $routes[] = self::create('POST','save','tasks','tasksController','save');\n $routes[] = self::create('GET','register','accounts','accountsController','register');\n $routes[] = self::create('POST','register','accounts','accountsController','store');\n $routes[] = self::create('POST','insertTodo','tasks','tasksController','insertTodo');\n $routes[] = self::create('GET','getTodo','tasks','tasksController','getTodo');\n $routes[] = self::create('GET','logout','accounts','accountsController','logout');\n $routes[] = self::create('GET','myprofile','accounts','accountsController','myprofile');\n \n return $routes;\n }", "static public function getBuildtimRoutes(): array\n\t{\n\t\treturn Router::$builtimeRoutes;\n\t}", "public function getRoutes(): array;", "public function getRoutes(): array;", "public function build()\r\n {\r\n $routes = require __DIR__ . './../../app/config/routes.php';\r\n\r\n foreach ($routes as $index => $entry) {\r\n $route = new Route(\r\n $entry['path'],\r\n $entry['action'],\r\n $entry['method']\r\n );\r\n\r\n $this->request[] = $route;\r\n }\r\n }", "function getRoutes()\n {\n $routes['default'] = new Proj_Controller_Route('*',\n array(\n 'access' => 'public',\n 'module' => 'home',\n 'control' => 'index',\n 'action' => 'process',\n 'id' => -1,\n 'id2' => -1,\n )\n );\n $routes['default_id'] = new Proj_Controller_Route(':id/:id2',\n array(\n 'access' => 'public',\n 'module' => 'home',\n 'control' => 'index',\n 'action' => 'process',\n 'id' => -1,\n 'id2' => -1,\n ),\n array('id' => '\\d+', 'id2' => '\\d+')\n ); \n $routes['public'] = new Proj_Controller_Route(':access/:module/:control/:id/:id2',\n array(\n 'access' => 'public',\n 'action' => 'process',\n 'id' => -1,\n 'id2' => -1,\n ),\n array(\n 'access' => 'public',\n 'module' => \n '\\b(' .\n 'home' . \n ')\\b', \n 'id' => '\\d+', 'id2' => '\\d+'\n )\n );\n $routes['admin'] = new Proj_Controller_Route(':access/:module/:control/:id/:id2',\n array(\n 'access' => 'admin',\n 'action' => 'process',\n 'id' => -1,\n 'id2' => -1,\n ),\n array(\n 'access' => 'admin',\n 'module' => \n '\\b(' . \n 'phy_team|sch_team|person|unit|field|field_site|event|admin|' .\n 'sched_div|sched_ref|sched_team|sched_field' . \n ')\\b', \n 'id' => '\\d+', 'id2' => '\\d+'\n )\n );\n return $routes;\n }", "public function getRoutes(): array\n {\n return [];\n }", "public static function getRoutes()\n {\n //Adianti Modules\n //Admin\n //Todo remover apos testes\n $routes['EmptyPage'] = EmptyPage::class;\n $routes['LoginForm'] = LoginForm::class;\n $routes['SystemDatabaseExplorer'] = SystemDatabaseExplorer::class;\n $routes['SystemDataBrowser'] = SystemDataBrowser::class;\n $routes['SystemGroupForm'] = SystemGroupForm::class;\n $routes['SystemGroupList'] = SystemGroupList::class;\n $routes['SystemPageBatchUpdate'] = SystemPageBatchUpdate::class;\n $routes['SystemPHPErrorLogView'] = SystemPHPErrorLogView::class;\n $routes['SystemPHPInfoView'] = SystemPHPInfoView::class;\n $routes['SystemPreferenceForm'] = SystemPreferenceForm::class;\n $routes['SystemProfileView'] = SystemProfileView::class;\n $routes['SystemProfileForm'] = SystemProfileForm::class;\n $routes['SystemProgramForm'] = SystemProgramForm::class;\n $routes['SystemProgramList'] = SystemProgramList::class;\n $routes['SystemSQLPanel'] = SystemSQLPanel::class;\n $routes['SystemSupportForm'] = SystemSupportForm::class;\n $routes['SystemTableList'] = SystemTableList::class;\n $routes['SystemUnitForm'] = SystemUnitForm::class;\n $routes['SystemUnitList'] = SystemUnitList::class;\n $routes['SystemUserForm'] = SystemUserForm::class;\n $routes['SystemUserList'] = SystemUserList::class;\n $routes['TStandardSeek'] = TStandardSeek::class;\n $routes['SystemRegistrationForm'] = SystemRegistrationForm::class;\n $routes['SystemRequestPasswordResetForm'] = SystemRequestPasswordResetForm::class;\n//\n// //Available\n $routes['PublicView'] = PublicView::class;\n $routes['CommonPage'] = CommonPage::class;\n $routes['MessageList'] = MessageList::class;\n $routes['NotificationList'] = NotificationList::class;\n $routes['SearchBox'] = SearchBox::class;\n $routes['WelcomeView'] = WelcomeView::class;\n//\n// //Communication\n $routes['SystemDocumentCategoryFormList'] = SystemDocumentCategoryFormList::class;\n $routes['SystemDocumentForm'] = SystemDocumentForm::class;\n $routes['SystemDocumentList'] = SystemDocumentList::class;\n $routes['SystemDocumentUploadForm'] = SystemDocumentUploadForm::class;\n $routes['SystemMessageForm'] = SystemMessageForm::class;\n $routes['SystemMessageFormView'] = SystemMessageFormView::class;\n $routes['SystemMessageList'] = SystemMessageList::class;\n $routes['SystemNotificationFormView'] = SystemNotificationFormView::class;\n $routes['SystemNotificationList'] = SystemNotificationList::class;\n $routes['SystemSharedDocumentList'] = SystemSharedDocumentList::class;\n//\n// //Log\n $routes['SystemAccessLogList'] = SystemAccessLogList::class;\n $routes['SystemAccessLogStats'] = SystemAccessLogStats::class;\n $routes['SystemChangeLogView'] = SystemChangeLogView::class;\n $routes['SystemSqlLogList'] = SystemSqlLogList::class;\n\n $routes['SystemSqlLog'] = SystemSqlLog::class;\n $routes['SystemAccessLog'] = SystemAccessLog::class;\n $routes['SystemDocumentUploaderService'] = SystemDocumentUploaderService::class;\n $routes['AdiantiUploaderService'] = AdiantiUploaderService::class;\n $routes['AdiantiMultiSearchService'] = AdiantiMultiSearchService::class;\n $routes['SystemModulesCheckView'] = SystemModulesCheckView::class;\n//\n $routes['download'] = 'download.php';\n\n return $routes;\n }", "private function getAccessRoutes()\n {\n return [\n \"login\" => self::$base . \"login\",\n \"setActivity\" => self::$base . \"setActivity\"\n \n ];\n }", "public function routes();", "protected function initRoutes() {\n $array['home'] = array('route' => '/phpmvc/public/index', 'controller' => 'index', 'action' => 'index');\n $array['empresa'] = array('route' => '/phpmvc/public/empresa', 'controller' => 'index', 'action' => 'empresa');\n $array['pagenotfound'] = array('route' => '/phpmvc/public/pagenotfound', 'controller' => 'index', 'action' => 'pagenotfound');\n $this->setRoutes($array);\n }", "public static function load_routes() {\n\t\tnew Routes\\Internal_Stats();\n\t\tnew Routes\\Plugin();\n\t\tnew Routes\\Locale_Banner();\n\t\tnew Routes\\Plugin_Favorites();\n\t\tnew Routes\\Commit_Subscriptions();\n\t\tnew Routes\\Popular_Tags();\n\t\tnew Routes\\Query_Plugins();\n\t\tnew Routes\\SVN_Access();\n\t\tnew Routes\\Plugin_Committers();\n\t\tnew Routes\\Plugin_Support_Reps();\n\t\tnew Routes\\Plugin_Self_Close();\n\t\tnew Routes\\Plugin_Self_Transfer();\n\t\tnew Routes\\Plugin_Release_Confirmation();\n\t\tnew Routes\\Plugin_E2E_Callback();\n\t\tnew Routes\\Plugin_Categorization();\n\t\tnew Routes\\Plugin_Upload();\n\t}", "protected function fetchRoutes()\n\t{\n\t\treturn $this->readConfig('routes');\n\t}", "public static function getRoutes(): array\n {\n return self::$routes;\n }", "protected static function _load_routes () {\n\t\t\tif( is_null( self::$routes ) )\n\t\t\t\tself::$routes = Config::get( 'routes.routes', array() );\n\t\t}", "protected function iniRoutes() {\n \n }", "public function setRoutes() {\n $this->api->addRoute(\"/^\\/grid\\/(\\d+)\\/rooms\\/?$/\", 'getRoomsByGrid', $this, 'GET', \\Auth::READ); // Get rooms for the given grid\n $this->api->addRoute(\"/^\\/grid\\/(\\d+)\\/room\\/(\\d+)\\/?$/\", 'getRoomById', $this, 'GET', \\Auth::READ); // Get the given room on the grid\n $this->api->addRoute(\"/^\\/grid\\/(\\d+)\\/region\\/([a-z0-9-]{36})\\/rooms\\/?$/\", 'getRoomsByGridRegion', $this, 'GET', \\Auth::READ); // Get the given room on the grid\n }", "public static function routes()\n\t{\n\t\treturn Route::all();\n\t\t\n\t}", "function &routes($newRoutes=null) {\n static $routes = array();\n if (isset($newRoutes))\n $routes = $newRoutes;\n return $routes;\n}", "public function getRoutes();", "public function getRoutes();", "public function getRoutes();", "public function getRoutes();", "public function getRoutes();", "public function getRoutes();", "public function routes() {\r\n $routes = array();\r\n\r\n $tabs = array(\r\n 'tabs' => t('Default primary tab'),\r\n 'tabs/second' => t('Second'),\r\n 'tabs/third' => t('Third'),\r\n 'tabs/fourth' => t('Fourth'),\r\n 'tabs/default/second' => t('Second'),\r\n 'tabs/default/third' => t('Third'),\r\n );\r\n\r\n foreach ($tabs AS $path => $title) {\r\n $machine_name = 'examples.menu_example.'. str_replace('/', '_', $path);\r\n $routes[$machine_name] = new Route(\r\n '/examples/menu_example/' . $path,\r\n array(\r\n '_content' => 'Drupal\\menu_example\\Controller\\MenuExampleController::tabsPage',\r\n '_title' => $title,\r\n 'path' => $path,\r\n 'title' => $title,\r\n ),\r\n array(\r\n '_access' => 'TRUE',\r\n )\r\n );\r\n }\r\n\r\n return $routes;\r\n }", "protected function initRoutes()\n {\n foreach ($this->routes as $name => $data) {\n $this->application\n ->match($data['match'], array($this, $data['method']))\n ->bind($name);\n }\n }" ]
[ "0.7092767", "0.70316106", "0.69691986", "0.69598794", "0.68064576", "0.67490804", "0.67490804", "0.6704923", "0.6703123", "0.6692423", "0.66728425", "0.66407484", "0.66363704", "0.66189814", "0.66108143", "0.660761", "0.6606263", "0.65980524", "0.65978646", "0.65966266", "0.6554874", "0.65544873", "0.65530473", "0.65530473", "0.65530473", "0.65530473", "0.65530473", "0.65530473", "0.6552057", "0.6531685" ]
0.7106072
0
Question types that belongs to the answer.
public function questionTypes() { return $this->belongsToMany(QuestionType::class, 'answer_question_types') ->withPivot(['score', 'factor']) ->withTimestamps(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function startQuizQuestionAnswerTypesSet() {\n\t\t\t$pro_quiz_question_answer_types_import = new WpProQuiz_Model_AnswerTypes();\n\n\t\t\treturn $pro_quiz_question_answer_types_import->get_object_as_array();\n\t\t}", "function getQuestionType() {\n\t\treturn 'question';\n\t}", "function getQuestionType()\n\t{\n\t\treturn $this->object->getQuestionType();\n\t}", "function getQuestionType()\n\t{\n\t\treturn \"\";\n\t}", "public static function typeChoiceList(): array\n {\n return [\n static::RELATED_TO,\n static::EXACT_MATCH_OF,\n static::PART_OF,\n static::REPLACED_BY,\n static::PRECEDES,\n static::SKILL_LEVEL,\n static::IS_PEER_OF,\n ];\n }", "function getQuestionType()\n\t{\n\t\treturn \"assFlashQuestion\";\n\t}", "public function getQuestionType()\n {\n return $this->questionType;\n }", "public function get_all_exam_types() {\n return \n array(\n '01' => 'MAY/JUNE',\n '02' => 'NOV/DEC',\n '03' => 'Modular (March)',\n '04' => 'Modular (December)',\n '05' => 'Modular (July)'\n );\n \n \n }", "private static function pStrict($answer=\"\",$type=\"\")\n\t{\n\t\t//TODO: strictly to the type, it doesn't analyze the label (that is different, of course)\n\t\t$ret=array();\n\t\tif( (is_array($answer)) && (count($answer) > 0) )\n\t\t{\n\t\t\tforeach($answer as $data) {\n\t\t\t\tif(strtolower($data['type']) == $type)\n\t\t\t\t\t$ret[]=$data;\n\t\t\t}\n\t\t}\n\n\t\treturn $ret;\n\t}", "public function getExpressionTypes()\n\t{\n\t\treturn array(\n\t\t\tiQuestionCondition::PercentageResultExpression,\n\t\t\tiQuestionCondition::NumericResultExpression,\n\t\t\tiQuestionCondition::EmptyAnswerExpression,\n\t\t);\n\t}", "function get_qtype( $type_id ) {\n \n switch( $type_id ) {\n case TRUEFALSE:\n $name = 'truefalse';\n break;\n case MULTICHOICE:\n $name = 'multichoice';\n break;\n case SHORTANSWER:\n $name = 'shortanswer';\n break;\n case NUMERICAL:\n $name = 'numerical';\n break;\n case MATCH:\n $name = 'matching';\n break;\n case DESCRIPTION:\n $name = 'description';\n break;\n case MULTIANSWER:\n $name = 'cloze';\n break;\n default:\n $name = 'unknown';\n }\n return $name;\n}", "public function GetEnquiryTypes() {\n\n\t\tif (DEBUG) Logger::Msg(get_class($this).\"::\".__FUNCTION__.\"()\");\n\n\t\tglobal $db;\n\n\t\t$db->query(\"SELECT name,code,sort_order FROM enquiry_type ORDER BY sort_order ASC;\");\n\n\t\tif ($db->GetNumRows() >= 1) {\n\t\t\t$aRes = $db->getRows(PGSQL_ASSOC);\n\n\t\t\tforeach($aRes as $aRow) {\n\t\t\t\t\t\n\t\t\t\t$this->aEnquiry[$aRow['sort_order']] = array('name' => $aRow['name']\n\t\t\t\t,'code' => $aRow['name']\n\t\t\t\t,'sort_order' => $aRow['sort_order']\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\t\n\t}", "public function setQuestionType($questionType) {\n\t}", "public function choice_type($attributes) {\n $correct_status = Arr::pluck($attributes, 'correctness');\n $only_correct = array_filter($correct_status);\n $num_correct = count($only_correct);\n if ($num_correct > 1) {\n return 'multiple';\n } else if ($num_correct == 1) {\n return 'unique';\n } else {\n throw new Exception('Set of answers without atleast 1 correct answer');\n }\n }", "public function question()\n {\n return $this->hasMany('App\\Form_question', 'type');\n }", "public function getResultTypes()\n {\n $resignation = $this->translate(\"Resignation\");\n $byPoints = $this->translate(\"Win by Points\");\n $draw = $this->translate(\"Draw\");\n $forfeit = $this->translate(\"Lost by Forfeit\");\n $suspended = $this->translate(\"Game Suspended\");\n $onTime = $this->translate(\"Lost on Time\");\n\n\n return array(\n self::RESIGNATION => $resignation,\n self::BYPOINTS => $byPoints,\n self::DRAW => $draw,\n self::FORFEIT => $forfeit,\n self::SUSPENDED => $suspended,\n self::ONTIME => $onTime,\n );\n }", "public static function getQuestionAnswers($question_id, $type) {\n\t\t\t\tif($question_id > 0){\n\t\t\t\t\t\tif ($type != \"open-choices\") {\n\t\t\t\t\t\t\t\t$sql = \"SELECT answer, a.number, a.id, a.correct, a.points, a.question_id\n\t\t\t\t\t\t\t\t\t\t\t\tFROM quiz_answers AS a\n\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquiz_questions AS b\n\t\t\t\t\t\t\t\t\t\t\t\tON\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ta.question_id = b.id\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE a.question_id = ? ORDER by number\n\t\t\t\t\t\t\t\t\t\t\t\t\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$sql = 'SELECT a.number, a.id, a.choice, a.points, a.question_id\n\t\t\t\t\t\t\t\t\t\t\t\tFROM quiz_open_answer_choices AS a\n\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquiz_questions AS b\n\t\t\t\t\t\t\t\t\t\t\t\tON\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ta.question_id = b.id\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE a.question_id = ? ORDER by number';\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn self::find_by_sql($sql, [$question_id]);\n\t\t\t\t}\n }", "public static function allTypes(): array\n {\n return [\n static::RELATED_TO,\n static::EXACT_MATCH_OF,\n static::PART_OF,\n static::REPLACED_BY,\n static::PRECEDES,\n static::SKILL_LEVEL,\n static::IS_PEER_OF,\n static::EXEMPLAR,\n\n static::CHILD_OF,\n ];\n }", "public function question() {\n return $this->hasMany(Questionbank::class,'type_id');\n }", "abstract public function getTypes();", "public function question_classify_providers() {\n $data = [];\n\n $data['correct_response'] = [\n 'qtype' => 'varnumunit',\n 'which' => 'simple_1_m',\n 'qdata' => [\n 'units' => [\n 1 => new qtype_varnumunit_unit(\n 1,\n 'match(m)',\n qtype_varnumunit::SPACEINUNIT_REMOVE_ALL_SPACE,\n 'Spacing feedback',\n 1,\n 1, 1,\n 'Right unit',\n 1),\n ],\n 'answers' => [\n 1 => new qtype_varnumericset_answer(\n 1,\n '1',\n '1',\n 'Correct',\n FORMAT_HTML,\n '0', '',\n '1',\n 0,\n 0,\n 0,\n 0),\n ]\n ],\n 'expects' => [\n '1m' => [\n 'unitpart' => new question_classified_response('match(m)', 'm', 1),\n 'numericpart' => new question_classified_response(1, 1, 1),\n ],\n '' => [\n 'unitpart' => question_classified_response::no_response(),\n 'numericpart' => question_classified_response::no_response(),\n ]\n ]\n ];\n $data['correct_response_require_space_between_number_n_unit'] = [\n 'qtype' => 'varnumunit',\n 'which' => 'simple_1_m',\n 'qdata' => [\n 'units' => [\n 1 => new qtype_varnumunit_unit(\n 1,\n 'match(m)',\n qtype_varnumunit::SPACEINUNIT_PRESERVE_SPACE_REQUIRE,\n 'Spacing feedback',\n 1,\n 1, 1,\n 'Right unit',\n 1),\n ],\n 'answers' => [\n 1 => new qtype_varnumericset_answer(\n 1,\n '1',\n '1',\n 'Correct',\n FORMAT_HTML,\n '0', '',\n '1',\n 0,\n 0,\n 0,\n 0),\n ]\n ],\n 'expects' => [\n '1m' => [\n 'unitpart' => new question_classified_response('match(m)', 'm', 0),\n 'numericpart' => new question_classified_response(1, 1, 1),\n ],\n '1 m' => [\n 'unitpart' => new question_classified_response('match(m)', 'm', 1),\n 'numericpart' => new question_classified_response(1, 1, 1),\n ],\n '1 m' => [\n 'unitpart' => new question_classified_response('match(m)', 'm', 0),\n 'numericpart' => new question_classified_response(1, 1, 1),\n ],\n '' => [\n 'unitpart' => question_classified_response::no_response(),\n 'numericpart' => question_classified_response::no_response(),\n ]\n ]\n ];\n\n return $data;\n }", "public function getTypes()\n {\n return [\n 'normal' => 'Normal',\n 'batch' => 'Batch',\n ];\n }", "function local_questionbanktagfilter_get_question_bank_column_types($question_bank_view)\n{\n if ($question_bank_view == 'quiz_question_bank_view') {\n return array();\n }\n return array('tags' => new local_questionbanktagfilter_question_bank_column($question_bank_view));\n}", "public function typeProvider()\n {\n return [\n ['regular', true],\n ['tutorial', true],\n ['foo', false],\n [null, false],\n [false, false],\n [1, false],\n [true, false],\n ];\n }", "public function typeProvider()\n {\n return array(\n array('regular', true),\n array('tutorial', true),\n array('foo', false),\n array(null, false),\n array(false, false),\n array(1, false),\n array(true, false)\n );\n }", "public function getTypes();", "private function createSocialQuestions() {\n $questions = array();\n $questionTypeCreate = array(\n 'question_active' => array('percent' => 68),\n 'question_pending' => array('percent' => 3, 'status' => 'pending'),\n 'question_suspended' => array('percent' => 3, 'status' => 'suspended'),\n 'question_deleted' => array('percent' => 2, 'status' => 'deleted'),\n 'question_locked' => array('percent' => 5, 'locked' => true),\n 'question_deleted_locked' => array('percent' => 1, 'status' => 'deleted', 'locked' => true),\n 'question_suspended_locked' => array('percent' => 3, 'status' => 'suspended', 'locked' => true),\n 'question_pending_locked' => array('percent' => 1, 'status' => 'pending', 'locked' => true),\n 'question_rate' => array('percent' => 3, 'rate' => true),\n 'question_rate_pending' => array('percent' => 2, 'status' => 'pending', 'rate' => true),\n 'question_flag_redundant' => array('percent' => 3, 'flag' => array('type' => 'redundant')),\n 'question_flag_miscategorized' => array('percent' => 3, 'flag' => array('type' => 'miscategorized')),\n 'question_flag_spam_suspended' => array('percent' => 2, 'status' => 'suspended', 'flag' => array('type' => 'spam')),\n 'question_flag_inappropriate_suspended' => array('percent' => 1, 'status' => 'suspended', 'flag' => array('type' => 'inappropriate')),\n );\n\n $availableUserCount = count($this->users);\n foreach ($questionTypeCreate as $questionType => $questionInfo) {\n $questionTypeCount = ($questionInfo['percent'] / 100) * $this->questionCount;\n $questionTypeCount = ($questionTypeCount < 1 ) ? round($questionTypeCount * 10) : round($questionTypeCount);\n $questionCreatedCountForType = 0;\n\n for ($q = 0; $q < $questionTypeCount; $q++) {\n //fetch the users in round robin fashion\n ($socialUserID = next($this->users)) || ($socialUserID = reset($this->users));\n if ($socialUserID) {\n if ($q % 10 === 0) {\n $this->flushOutput();\n }\n $questionID = $this->createSocialQuestion($socialUserID, $questionInfo);\n if ($questionID && !in_array($questionType, array('question_deleted', 'question_deleted_locked'))) {\n $questions[] = $questionID;\n $questionCreatedCountForType ++;\n }\n }\n }\n echo PHP_EOL . \"Total social questions created for question type $questionType :: $questionCreatedCountForType \" . PHP_EOL;\n }\n $this->questions = $questions;\n\n }", "public function dataShouldAskQuestion(): array {\n $dummyQuestion = $this->dummyQuestion();\n return [\n [\n $dummyQuestion,\n [\n 'demo_content' => 'ALL',\n ],\n TRUE,\n ],\n ];\n }", "public function getType() {\n\t\tforeach ($this->typeForPercentage['percentage'] as $_index => $_percentage) {\n\t\t\tif ($this->percentage >= $_percentage) {\n\t\t\t\t$type = $this->typeForPercentage['type'][$_index];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ($type === 'PL' && strtoupper($this->questionType) === 'MC') {\n\t\t\t$type = 'PT';\n\t\t}\n\t\treturn $type;\n\t}", "public function definition()\n {\n\n $type = collect([\n 'number_integer' => \"Número Inteiro\",\n 'number_decimal' => \"Número decimal\",\n 'boolean' => \"Verdadeiro e falso\",\n\n ])->keys()->random(1)->first();\n $product = Product::find($this->faker->numberBetween(1,100));\n return [\n 'list_id'=>Listing::factory(),\n 'product_id'=>$product->id,\n 'description'=>$this->faker->text,\n 'mandatory'=>$this->faker->boolean,\n 'question_status'=>$this->faker->boolean,\n 'question_type'=>$type,\n 'weight_question'=>$this->faker->numberBetween(1, 100),\n 'has_action'=>$this->faker->boolean,\n 'link_video'=>$this->faker->imageUrl(),\n 'amount'=>$this->faker->numberBetween(1,100),\n 'ean_code'=>$this->faker->creditCardNumber,\n ];\n }" ]
[ "0.69226456", "0.6793768", "0.6441904", "0.6346172", "0.6317078", "0.62253743", "0.6152043", "0.6023218", "0.59839475", "0.5950607", "0.5929874", "0.5897633", "0.58860904", "0.5869891", "0.5848324", "0.5847114", "0.5829768", "0.57193154", "0.5674911", "0.5633246", "0.56296164", "0.5596382", "0.55607736", "0.54749465", "0.5454308", "0.5426705", "0.5417668", "0.5414091", "0.5385327", "0.5384938" ]
0.6903224
1
Set the view handler.
public function setHandler($handler);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setHandler($handler)\n\t{\n\t\t$this->handler = $handler;\n\t}", "public function setHandler($handler): void\n {\n $this->handler = $handler;\n }", "function _setHandler(&$handler) {\n\t\t$this->handler =& $handler;\n\t}", "public function setHandler(Handler $handler) {\n $this->handler = $handler;\n }", "public function setHandler(HandlerStack $handler)\n {\n $this->handler = $handler;\n }", "public function __handler()\n {\n $this->html((new \\view\\main\\IndexView())->output())->title('Main page');\n }", "function setHandler(HandlerInterface $handler)\n {\n $this->handler = $handler;\n }", "public function setView( \\Aimeos\\MW\\View\\Iface $view );", "public function setView(): void\n {\n include_once $this->router->getView();\n }", "public function setHandler( $handler ) {\n\n // if we have a handler specified as controllerName@controllerMethod...\n if ( is_string( $handler ) && preg_match( '/.+@.+/', $handler ) ) {\n\n // split the handler and action like controllerName@controllerMethod\n list( $controllerHandle, $method ) = explode( '@', $handler );\n } else if ( is_callable( $handler ) ) {\n\n // if we have a callback, we'll set this statically to the Lambda controller\n $controllerHandle = Route::LAMBDA_CLASS;\n $method = Route::DEFAULT_ACTION;\n } else {\n\n // no @ char in there, so this must be a class name only\n $controllerHandle = $handler;\n $method = $this->getName();\n }\n\n // Resolve the controller by uppercasing the first letter and appending \"Controller\", then look for the class\n // within the controllers namespace\n $controller = WebRoute::CONTROLLER_NAMESPACE . ucfirst( $controllerHandle ) . WebRoute::CONTROLLER_SUFFIX;\n\n try {\n // create a controller instance\n $this->handler = new $controller();\n }\n catch ( Throwable $exception ) {\n // doesn't seem to be a valid class tho...\n throw new RuntimeException( 'Invalid route handler: ' . $exception->getMessage(), 0, $exception );\n }\n\n $this->action = $method;\n\n // if we have a callback, we'll set the action on the Lambda pseudo controller\n if ( is_callable( $handler ) ) {\n\n /** @var \\Radiergummi\\DynDns\\Controllers\\LambdaController $handler */\n /** @noinspection PhpUndefinedMethodInspection */\n $this->handler->setAction( $handler );\n }\n }", "abstract public function setView($view);", "public function setRequestHandler( EntityDataRequestHandler $requestHandler ) {\n\t\t$this->requestHandler = $requestHandler;\n\t}", "public static function viewHandler($view, $data = array()){\n include('Views/' . $view . '.php');\n }", "public function setHandler(string $handler): self\n {\n $this->handler = $handler;\n\n return $this;\n }", "protected function getFosRest_ViewHandlerService()\n {\n $this->services['fos_rest.view_handler'] = $instance = new \\FOS\\RestBundle\\View\\ViewHandler(${($_ = isset($this->services['router']) ? $this->services['router'] : $this->get('router')) && false ?: '_'}, ${($_ = isset($this->services['fos_rest.serializer']) ? $this->services['fos_rest.serializer'] : $this->get('fos_rest.serializer')) && false ?: '_'}, ${($_ = isset($this->services['templating']) ? $this->services['templating'] : $this->get('templating', ContainerInterface::NULL_ON_INVALID_REFERENCE)) && false ?: '_'}, ${($_ = isset($this->services['request_stack']) ? $this->services['request_stack'] : $this->get('request_stack')) && false ?: '_'}, array('json' => false, 'html' => true), 400, 204, false, array('html' => 302), 'twig');\n\n $instance->setSerializeNullStrategy(false);\n $instance->registerHandler('jsonp', array(0 => new \\FOS\\RestBundle\\View\\JsonpHandler('JSON_CALLBACK'), 1 => 'createResponse'));\n\n return $instance;\n }", "protected function setView ($view)\n {\n $this->_view = $view;\n }", "private function setView()\r\n {\r\n\r\n $view = new View();\r\n $view->setDI($this->di);\r\n $view->setViewsDir(APP_PATH . DS . $this->config->application->viewsDir);\r\n\r\n $view->registerEngines([\r\n '.volt' => function ($view) {\r\n $volt = new VoltEngine($view, $this->di);\r\n\r\n $volt->setOptions([\r\n 'compiledPath' => BASE_PATH . DS . $this->config->application->cacheDir,\r\n 'compiledSeparator' => '_',\r\n ]);\r\n\r\n return $volt;\r\n },\r\n '.phtml' => PhpEngine::class\r\n\r\n ]);\r\n\r\n $em = $this->di->getShared('eventsManager');\r\n\r\n $em->attach(\r\n \"view\",\r\n function (Event $event, $view) {\r\n if ($view->getActiveRenderPath()) {\r\n //echo '<pre class=\"container-fluid\"><div class=\"row\"><div class=\"events col-sm-12\">' . $event->getType() . \": \" . $view->getActiveRenderPath() . PHP_EOL . \"</div></div></pre>\";\r\n }\r\n }\r\n );\r\n\r\n $view->setEventsManager($em);\r\n\r\n $this->di->set(\"view\", $view);\r\n\r\n return $this;\r\n }", "public function setHandler(callable $handler): RouteInfo\n {\n $this->handler = $handler;\n\n return $this;\n }", "public function setHandler($handler) {\n\n\t\t// Check activation support\n\t\tif (method_exists($handler, 'onActivation')) {\n\t\t\tregister_activation_hook($this->plugin->file, [$handler, 'onActivation']);\n\t\t}\n\n\t\t// Check deactivation support\n\t\tif (method_exists($handler, 'onDeactivation')) {\n\t\t\tregister_deactivation_hook($this->plugin->file, [$handler, 'onDeactivation']);\n\t\t}\n\n\t\t// Check uninstall support\n\t\tif (method_exists($handler, 'onUninstall')) {\n\t\t\tregister_uninstall_hook($this->plugin->file, ['\\\\'.get_class($handler), 'onUninstall']);\n\t\t}\n\t}", "static function setView( Frame_View $view )\n\t{\n\t\tself::getInstance()->__view = $view;//guarda referencia\n\t}", "public function setView()\r\n {\r\n $this->view->header = $this->getHeader();\r\n $this->view->subHeader = $this->getSubHeader();\r\n $this->view->content = $this->getContent();\r\n if (empty($this->view->hrClasses)) {\r\n $this->view->hrClasses = $this->getHRClasses();\r\n }\r\n }", "public function setHandler(Handler $handler)\n\t{\n\t\t$this->handler = $handler;\n\t\treturn $this;\n\t}", "protected function registerHandler()\n {\n $this->app['exception'] = $this->app->share(function ($app) {\n return new Handler($app, $app['exception.plain'], $app['exception.debug']);\n });\n }", "public function setAccessHandler(AccessHandler $accessHandler)\n {\n $this->accessHandler = $accessHandler;\n }", "public function setView($view)\n {\n $this->view = $view;\n }", "public function setView(View $view)\n {\n $this->_view = $view;\n }", "public function setConfigHandler($config)\n {\n $this->config = $config;\n }", "final protected function setEventHandler(EventHandler $event_handler)\r\n\t\t{\r\n\t\t\t$this->eh_ptr = $event_handler;\r\n\t\t}", "public function set()\n {\n return set_error_handler([$this, 'handle'], E_ALL);\n }", "public function __construct($handler) {\n\t\t$this->handler = $handler;\n\t\tparent::__construct(\"SubscribeView\");\n\t}" ]
[ "0.7010239", "0.6791446", "0.6710183", "0.67101043", "0.6417096", "0.62439334", "0.62366915", "0.6231348", "0.62126815", "0.61984456", "0.61359733", "0.6045519", "0.6000665", "0.5986394", "0.5984068", "0.5970484", "0.5928888", "0.59211147", "0.59092855", "0.58709884", "0.5846346", "0.5836903", "0.5823157", "0.58027744", "0.5750204", "0.5739988", "0.57357556", "0.5729965", "0.567254", "0.5664301" ]
0.7413365
0
Get an playback token. If you are using this for web playback you must supply a domain
public function getPlaybackToken($domain) { $params = $this->getCallParams(__FUNCTION__, func_get_args(), ['domain']); return $this->getJson($params)->result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function video_getrecordtoken($sessionid=null) {\n \n $token = $this->sendRequest('viddler.videos.getRecordToken','sessionid='.$sessionid);\n \n if (isset($token['error'])) {\n return $token['error']['description'];\n } else {\n return $token['record_token'];\n }\n }", "public function request_youtube()\n\t{\n\t\t$params['key'] = 'www.viddon.com';\n\t\t$params['secret'] = 'PhKZBCgdQxVcXkYgs4ffrBas';\n\t\t$params['algorithm'] = 'HMAC-SHA1';\n\t\t\n\t\t$this->load->library('google_oauth', $params);\n\t\t$data = $this->google_oauth->get_request_token(site_url('subevideo/access_youtube'));\n\t\t$this->session->set_userdata('token_secret', $data['token_secret']);\n\t\tredirect($data['redirect']); \n\t}", "private function getToken() {\n\t\t$req = $this->request(SS_SERVER.\"/1/auth/\", array(\n\t\t\t\"username\" => SS_USER,\n\t\t\t\"password\" => SS_PASS\n\t\t));\n\t\tif ($req['success']) {\n\t\t\treturn $req['session_token'];\n\t\t}\n\t}", "protected function getToken()\n {\n $response = $this->request(\n 'GET',\n '/webservice.php?operation=getchallenge&username=' . $this->user\n );\n\n return $response->result->token;\n }", "public function access_token()\n {\n if (isset($_SERVER[\"HTTP_APPNAME\"])) //SAE\n {\n if ($ACCESS_TOKEN = $this -> kv -> get(\"access_token\"))\n {\n $expires_in = $this -> kv -> get(\"expires_in\");\n $create_time = $this -> kv -> get(\"create_time\");\n }\n }\n else //LOCAL\n {\n if ($json = file_get_contents($this -> tokenfile))\n {\n $result = json_decode($json);\n $ACCESS_TOKEN = $result -> access_token;\n $expires_in = $result -> expires_in;\n $create_time = filemtime($this -> tokenfile);\n }\n }\n\n //token should not be expired\n $time = time();\n if (!$ACCESS_TOKEN || $time - $create_time > 0.9 * $expires_in)\n $ACCESS_TOKEN = $this -> get();\n\n return $ACCESS_TOKEN;\n }", "function sb_dialogflow_get_token() {\n $token = sb_get_setting('dialogflow-token');\n if (empty($token)) {\n return new SBError('dialogflow-refresh-token-not-found', 'sb_dialogflow_get_token');\n }\n $response = sb_download('https://board.support/synch/dialogflow.php?refresh-roken=' . $token);\n if ($response != 'api-dialogflow-error' && $response != false) {\n $token = json_decode($response, true);\n if (isset($token['access_token'])) {\n return $token['access_token'];\n }\n }\n return new SBError('dialogflow-refresh-token-error', 'sb_dialogflow_get_token', $response);\n}", "function fetchRequestToken(){\n\t\t$json = file_get_contents($this->request_token_filepath);\n\t\treturn json_decode($json);\n\t\t\n\t}", "function getToken(array $options) {\n\n // Build array of scopes based on the options passed to the function\n $scopes = array();\n\n // Restrict token to work with javascript running in the given origins\n if (isset($options['origins']) && is_array($options['origins'])) {\n foreach ($options['origins'] as $orig) {\n $scopes[] = \"o;{$orig}\";\n }\n }\n\n // Access level on all streams\n if (isset($options['accessLevel']) && $options['accessLevel']) {\n $scopes[] = \"st;*;\" . $options['accessLevel'];\n }\n\n // Access restricted to some specific streams\n if (isset($options['streamAccess']) && is_array($options['streamAccess'])) {\n foreach ($options['streamAccess'] as $stAcc) {\n $stId = $stAcc[0];\n $level = 'read';\n if (isset($stAcc[1])) {\n $level = $stAcc[1];\n }\n $scopes[] = \"st;\" . $stId . \";\" . $level;\n }\n }\n\n // url-encoded body\n $body = new http\\Message\\Body();\n $body->append(\n new http\\QueryString([\n \"grant_type\" => \"client_credentials\",\n \"scope\" => implode(' ', $scopes)\n ])\n );\n\n // Build request with the appropriate headers and specified endpoint\n $request = new http\\Client\\Request(\"POST\",\n $options[\"apiEndpoint\"] . \"/v1/oauth/token\",\n [\n \"X-Cardstreams-AppId\" => $options[\"app_id\"],\n \"X-Cardstreams-AppKey\" => $options[\"app_key\"],\n \"Content-Type\" => \"application/x-www-form-urlencoded\"\n ],\n $body\n );\n $request->setOptions([ \"timeout\" => 10 ]);\n\n // Enqueue and send request\n $client = new http\\Client;\n $client->enqueue($request)->send();\n\n // Pop the last retrieved response and print results\n $response = $client->getResponse();\n printf(\"%s returned '%s' (%d)\\n\",\n $response->getTransferInfo(\"effective_url\"),\n $response->getInfo(),\n $response->getResponseCode()\n );\n\n // Return decoded json response if the transfer was successful. The token will be found\n // under the key \"access_token\"\n if ($response->getResponseCode() == 200) {\n return json_decode($response->body->toString(), true);\n } else {\n return NULL;\n }\n\n}", "function accessTokenURL() { return 'https://open.t.qq.com/cgi-bin/access_token'; }", "protected function liveToken()\n {\n $url = 'https://api.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials';\n $curl = curl_init();\n curl_setopt( $curl, CURLOPT_URL, $url );\n $credentials = base64_encode( $this -> key.':'.$this -> secret );\n curl_setopt( $curl, CURLOPT_HTTPHEADER, [ 'Authorization: Basic '.$credentials ] );\n curl_setopt( $curl, CURLOPT_HEADER, false );\n curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );\n\n $curl_response = curl_exec( $curl );\n\n return json_decode( $curl_response ) -> access_token;\n }", "public function get_session_token(){\n $content = $this->get(google_authsub_request::AUTHSESSION_URL);\n\n if( preg_match('/token=(.*)/i', $content, $matches) ){\n return $matches[1];\n }else{\n throw new moodle_exception('could not upgrade google authtoken to session token');\n }\n }", "public function access_youtube()\n\t{\n\t\t$params['key'] = 'www.viddon.com';\n\t\t$params['secret'] = 'PhKZBCgdQxVcXkYgs4ffrBas';\n\t\t$params['algorithm'] = 'HMAC-SHA1';\n\t\t\n\t\t$this->load->library('google_oauth', $params);\n\t\t\n\t\t$oauth = $this->google_oauth->get_access_token(false, $this->session->userdata('token_secret'));\n\t\t\n\t\t$this->session->set_userdata('oauth_token', $oauth['oauth_token']);\n\t\t$this->session->set_userdata('oauth_token_secret', $oauth['oauth_token_secret']);\n\t\t//var_dump(htmlentities($oauth['oauth_token']));\n\t\t\n\t\t/*\n\t\techo \" oauth token <br />\";\n\t\tvar_dump($oauth['oauth_token']);\n\t\techo \"oauth token secret <br />\";\n\t\tvar_dump($oauth['oauth_token_secret']);\n\t\t */\n\t}", "public function getToken() {\n if ($this->verbose) {\n echo \"AuthToken->getToken() => \\n\";\n var_dump($this->payload->access_token);\n }\n return $this->payload->access_token;\n }", "public function tokenURL() { \n\t\treturn $this->getServer().'/oauth/access_token'; \n\t}", "public function getToken();", "public function getToken();", "public function getToken();", "public function getToken();", "public function getToken();", "public static function requestToken()\n\t{\n\t\t$nf = new Netflix();\n\t\t$nf->setUrl('oauth/request_token');\n\t\treturn (array) $nf->executeJson();;\n\t}", "public function getToken()\n\t{\n\t if (empty($this->getSession())\n\t || ($_SESSION['oauth2']['expires'] !== null\n\t && $_SESSION['oauth2']['expires'] <= time())\n\t ) {\n\t return null;\n\t }\n\t return $this->getSession();\n\t}", "function get_request_token(){\n global $sign_method;\n $params = array();\n #$oauth_request = OAuthRequest::from_consumer_and_token($this->consumer,NULL,\"GET\",$request_url,$params);\n $oauth_request = OAuthRequest::from_consumer_and_token($this->consumer,NULL,\"GET\",DoubanOAuthClient::$request_url,$params);\n $oauth_request->sign_request($sign_method,$this->consumer,NULL);\n #$oauth_request->sign_request(DoubanOAuthClient::$sign_method,$this->consumer,NULL);\n return $this->fetch_token($oauth_request);\n }", "public function getServerToken ( $token_key );", "public function getToken(): string;", "function url_request_token()\n\t{\n\t\treturn 'https://api.{APP_URL}.com/oauth/request_token';\n\t}", "public function get_token() {\n\t\t$token = FALSE;\n\t\t\n\t\tif ($this->cnf['use_session']){\n\t\t\t$token = ($this->session->userdata('access_token')) ? $this->session->userdata('access_token') : FALSE;\n\t\t}else {\n\t\t\t$token = isset($_SESSION['access_token']) ? $_SESSION['access_token'] : FALSE;\n\t\t}\n\t\t\n\t\tif (!empty($token) && $this->cnf['encrypt']){\n\t\t\t$token = $this->encrypt->decode($token);\n\t\t}\n\t\t\n\t\treturn $token;\n\t}", "public static function getUserToken()\n {\n Channels::includeSystem('Session');\n Channels::includeSystem('User');\n\n $userid = User::getCurrentUserid();\n $userToken = Session::getSessionData('API', 'userToken:'.$userid);\n return $userToken;\n\n }", "public function getAuthTokenUrl();", "protected function getToken(): string\n {\n return $this->source->access_token;\n }", "public function getDeviceToken()\n {\n return $this->get(self::DEVICETOKEN);\n }" ]
[ "0.64532906", "0.5819836", "0.57947433", "0.57107425", "0.5697749", "0.5694391", "0.5689737", "0.56793624", "0.5661502", "0.5634424", "0.5621482", "0.56198335", "0.56023824", "0.55987763", "0.5573442", "0.5573442", "0.5573442", "0.5573442", "0.5573442", "0.5561285", "0.5551816", "0.54920864", "0.5488572", "0.5482723", "0.5472185", "0.5470315", "0.545609", "0.5436397", "0.54206145", "0.5409313" ]
0.7763238
0
This function takes a look at the schedulers_times table and pulls the jobs to be run at this moment in time (anything not run and with a run time or earlier than right now)
function checkPendingJobs() { global $sugar_config; global $timedate; $GLOBALS['log']->debug(''); $GLOBALS['log']->debug('----->Scheduler checking for qualified jobs to run.'); if(empty($this->db)) { $this->db = DBManagerFactory::getInstance(); } $fireTimeMinus = $timedate->asDb($timedate->getNow()->get('-1 minute')); $fireTimePlus = $timedate->asDb($timedate->getNow()->get('+1 minute')); // collapse list of schedulers where "catch_up" is 0 and status is "ready" (not "in progress, completed, etc."); $q = 'UPDATE schedulers_times st SET st.status = \'not run\' WHERE st.execute_time < '.$this->db->convert($this->db->quoted($fireTimeMinus), 'datetime').' AND st.status = \'ready\' AND st.scheduler_id IN (SELECT s.id FROM schedulers s WHERE st.scheduler_id = s.id AND s.catch_up = 0)'; $this->db->query($q); $q = 'SELECT DISTINCT st.id, st.scheduler_id, st.status, s.name, s.job FROM schedulers_times st LEFT JOIN schedulers s ON st.scheduler_id = s.id WHERE st.execute_time < '.$this->db->convert($this->db->quoted($fireTimeMinus), 'datetime'). ' AND st.deleted=0 AND s.deleted=0 AND st.status=\'ready\' AND s.status=\'Active\' ORDER BY s.name'; $r = $this->db->query($q); $count = 0; while($a = $this->db->fetchByAssoc($r)) { $job = BeanFactory::newBean('SchedulersJobs'); $paramJob = $a['scheduler_id']; $job->fire($sugar_config['site_url'].'/index.php?entryPoint=schedulers&type=job&job_id='.$paramJob.'&record='.$a['id']); $count++; } if($count < 1) { $GLOBALS['log']->debug('----->Scheduler has found 0 Jobs to fire'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function retrieveSchedulers() {\n\t\t$GLOBALS['log']->info('Gathering Schedulers');\n\t\t$executeJobs = array();\n\t\t$query \t= \"SELECT id \" .\n\t\t\t\t\"FROM schedulers \" .\n\t\t\t\t\"WHERE deleted=0 \" .\n\t\t\t\t\"AND status = 'Active' \" .\n\t\t\t\t\"AND date_time_start < \".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\",'datetime').\" \" .\n\t\t\t\t\"AND (date_time_end > \".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\",'datetime').\" OR date_time_end IS NULL)\";\n\t\t\t\t\n\t\t$result\t= $this->db->query($query);\n\t\t$rows=0;\n\t\t$executeTimes = array();\n\t\t$executeIds = array();\n\t\t$executeJobTimes = array();\n\t\twhile(($arr = $this->db->fetchByAssoc($result)) != null) {\n\t\t\t$focus = BeanFactory::getBean('Schedulers', $arr['id']);\n\t\t\t$executeTimes[$rows] = $this->deriveDBDateTimes($focus);\n\t\t\tif(count($executeTimes) > 0) {\n\t\t\t\tforeach($executeTimes as $k => $time) {\n\t\t\t\t$executeIds[$rows] = $focus->id;\n\t\t\t\t\t$executeJobTimes[$rows] = $time;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$rows++;\n\t\t}\n\t\t$executeJobs['ids'] = $executeIds;\n\t\t$executeJobs['times'] = $executeJobTimes;\n\t\treturn $executeJobs;\n\t}", "function insertSchedules() {\n\t\t$GLOBALS['log']->info('----->Scheduler retrieving scheduled items and adding them to Job queue.');\n\t\t$jobsArr = $this->retrieveSchedulers();\n\t\tif(is_array($jobsArr['ids']) && !empty($jobsArr['ids']) && is_array($jobsArr['times']) && !empty($jobsArr['times'])) {\n\t\t\tforeach($jobsArr['ids'] as $k => $ids) {\n\t\t\t\tforeach($jobsArr['times'][$k] as $j => $time) {\n\t\t\t\t\t$guid = create_guid();\n\t\t\t\t\t$q = \"INSERT INTO schedulers_times\n\t\t\t\t\t\t(id, deleted, date_entered, date_modified, scheduler_id, execute_time, status)\n\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'\".$guid.\"',\n\t\t\t\t\t\t0, \n\t\t\t\t\t\t\".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\", 'datetime').\",\n\t\t\t\t\t\t\".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\", 'datetime').\",\n\t\t\t\t\t\t'\".$jobsArr['ids'][$k].\"',\n\t\t\t\t\t\t\".db_convert(\"'\".$time.\"'\", 'datetime').\",\n\t\t\t\t\t\t'ready'\n\t\t\t\t\t\t)\";\n\t\t\t\t\t\t$this->db->query($q);\n\t\t\t\t\t$GLOBALS['log']->info('Query: '.$q);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function get_wpcron_jobs(): array\n {\n $times = [];\n $cron_jobs = _get_cron_array();\n foreach ($cron_jobs as $key => $task) {\n if (isset($task[$this->slug])) {\n $times[] = ['datetime' => get_date_from_gmt(date('Y-m-d H:i:s', $key), 'F j, Y H:i:s'), 'timestamp' => $key, 'job' => $task];\n }\n }\n return $times;\n }", "function scheduledTasks()\n{\n\t$db = database();\n\n\t$known_tasks = array();\n\t$db->fetchQuery('\n\t\tSELECT \n\t\t\tid_task, next_time, time_offset, time_regularity, time_unit, disabled, task\n\t\tFROM {db_prefix}scheduled_tasks',\n\t\tarray()\n\t)->fetch_callback(\n\t\tfunction ($row) use (&$known_tasks) {\n\t\t\tglobal $txt;\n\n\t\t\t// Find the next for regularity - don't offset as it's always server time!\n\t\t\t$offset = sprintf($txt['scheduled_task_reg_starting'], date('H:i', $row['time_offset']));\n\t\t\t$repeating = sprintf($txt['scheduled_task_reg_repeating'], $row['time_regularity'], $txt['scheduled_task_reg_unit_' . $row['time_unit']]);\n\n\t\t\t$known_tasks[] = array(\n\t\t\t\t'id' => $row['id_task'],\n\t\t\t\t'function' => $row['task'],\n\t\t\t\t'name' => $txt['scheduled_task_' . $row['task']] ?? $row['task'],\n\t\t\t\t'desc' => $txt['scheduled_task_desc_' . $row['task']] ?? '',\n\t\t\t\t'next_time' => $row['disabled'] ? $txt['scheduled_tasks_na'] : standardTime(($row['next_time'] == 0 ? time() : $row['next_time']), true, 'server'),\n\t\t\t\t'disabled' => $row['disabled'],\n\t\t\t\t'checked_state' => $row['disabled'] ? '' : 'checked=\"checked\"',\n\t\t\t\t'regularity' => $offset . ', ' . $repeating,\n\t\t\t);\n\t\t}\n\t);\n\n\treturn $known_tasks;\n}", "public function getSchedulersJob()\n {\n return BeanFactory::newBean('SchedulersJobs');\n }", "function station_current_schedule($scheds = array()) {\r\n\t$now = current_time(\"timestamp\");\r\n\t$current = array();\r\n\t\r\n\tforeach($scheds as $sched) {\r\n\t\r\n\t\tif($sched['day'] != date(\"l\", $now)) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\t\t\r\n\t\t$start = strtotime(date('Y-m-d', $now).$sched['start_hour'].':'.$sched['start_min'].' '.$sched['start_meridian']);\r\n\t\t\t\r\n\t\tif($sched['start_meridian'] == 'pm' && $sched['end_meridian'] == 'am') { //check for shows that run overnight into the next morning\r\n\t\t\t$end = strtotime(date('Y-m-d', ($now+86400)).$sched['end_hour'].':'.$sched['end_min'].' '.$sched['end_meridian']);\r\n\t\t}\r\n\t\telse {\r\n\t\t\t$end = strtotime(date('Y-m-d', $now).$sched['end_hour'].':'.$sched['end_min'].' '.$sched['end_meridian']);\r\n\t\t}\r\n\t\t\r\n\t\t//a show can't end before it begins... if it does, it ends the following day.\r\n\t\tif($end <= $start) {\r\n\t\t\t$end = $end + 86400;\r\n\t\t}\r\n\t\t\t\r\n\t\t//compare to the current timestamp\r\n\t\tif($start <= $now && $end >= $now) {\r\n\t\t\t$current = $sched;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn $current;\r\n}", "public function getRunningJobs() {\n $jobs = array();\n // TODO: impelement this function.\n return $jobs;\n }", "public function getScheduleTimes();", "private function generateCronJobs(){\n\t\t\n\t\t$jobs = \"\";\n\t\t\n\t\t$tmptime = $this->getUnixTime()-$this->hoursDelay*3600;\n\t\t//echo $tmptime . \",\" . time() . \"<hr>\";\n\t\t$timestart=0;\n\t\n\t\t//Classify the item depending on the time left.\n\t\t//Normalized time start.\n\t\tif(($tmptime-time())>43200) // >12h\n\t\t{\n\t\t\t$type = 1;\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=43200;\n\t\t\t$timestart-=43200;\n\t\t}\n\t\telseif(($tmptime-time())<=43200 && ($tmptime-time())>21600) // <=12h & >=6h\n\t\t{\n\t\t\t$type = 2;\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=21600;\n\t\t\t$timestart-=21600;\n\t\t}\n\t\telseif(($tmptime-time())<=21600 && ($tmptime-time())>7200) // <=6h & >=2h\n\t\t{\n\t\t\t$type = 3;\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=7200;\n\t\t\t$timestart-=7200;\n\t\t}\n\t\telseif(($tmptime-time())<=7200 && ($tmptime-time())>0) // <=2h\n\t\t{\n\t\t\t$type = 4;\t\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=1800;\n\t\t\t$timestart-=1800;\n\t\t}\n\t\t\n\t\tswitch($type){\n\t\t\tcase 1: // >12h\n\t\t\t\twhile($timestart-43200-12*3600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=43200;\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase 2: // <=12h & >=6h. 1 cronjob every 6 hours\n\t\t\t\twhile($timestart-6*3600-6*3600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=6*3600;\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase 3: // <=6h & >=2h. 1 cronjob every 60min\n\t\t\t\twhile($timestart-3600-2*3600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=3600;\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase 4: // <=2h. 1 cronjob every 30min\n\t\t\t\twhile($timestart-1800-1800>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=1800;\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\twhile($timestart-600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=600;\n\t\t\t\t}\n\t\t}\n\t\n\t\treturn $jobs;\n\t\n\t}", "protected static function get_schedules() {\n\t\t$schedules = wp_get_schedules();\n\t\tif ( ! empty( $schedules ) ) {\n\t\t\tuasort( $schedules, 'Cron_Schedule_Command::sort' );\n\t\t\t$schedules = array_map( 'Cron_Schedule_Command::format_schedule', $schedules, array_keys( $schedules ) );\n\t\t}\n\t\treturn $schedules;\n\t}", "static function getAllCronJobs(){\n\t\treturn shell_exec('crontab -l');\n\t}", "function getSchedulers() {\n\treturn array(\n\t\t\"wf2q+\" => array(\n\t\t\t\"name\" => \"Worst-case Weighted fair Queueing (default)\",\n\t\t\t\"parameter_format\" => \"type wf2q+\",\n\t\t\t\"description\" => \"Worst-case Weighted fair Queueing (WF2Q+) schedules flows with an associated weight. \".\n\t\t\t\t\t \"WF2Q+ is the default algorithm used by previous versions.\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"fifo\" => array(\n\t\t\t\"name\" => \"FIFO\",\n\t\t\t\"parameter_format\" => \"type fifo\",\n\t\t\t\"description\" => \"First-in-First-out is a fundamental queueing discipline which ensures packet sequence. \".\n\t\t\t\t\t \"Dynamic queues are not supported with the FIFO scheduler (all packets are stored in a single queue).\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"qfq\" => array(\n\t\t\t\"name\" => \"Quick Fair Queueing\",\n\t\t\t\"parameter_format\" => \"type qfq\",\n\t\t\t\"description\" => \"QFQ is a fast, low-complexity Approximated Fair Queueing scheduler.\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"rr\" => array(\n\t\t\t\"name\" => \"Round Robin\",\n\t\t\t\"parameter_format\" => \"type rr\",\n\t\t\t\"description\" => \"Round Robin (RR) schedules packets in a round-robin fashion.\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"prio\" => array(\n\t\t\t\"name\" => \"PRIO\",\n\t\t\t\"parameter_format\" => \"type prio\",\n\t\t\t\"description\" => \"PRIO schedules packets by their corresponding priority.\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"fq_codel\" => array(\n\t\t\t\"name\" => \"FQ_CODEL\",\n\t\t\t\"parameter_format\" => \"type fq_codel target %sms interval %sms quantum %s limit %s flows %s\",\n\t\t\t\"description\" => \"CoDel is a novel \\\"no knobs\\\", \\\"just works\\\", \\\"handles variable bandwidth and RTT\\\", and simple AQM algorithm.\"\n\t\t\t\t\t\t\t. \" As a scheduler, FQ_CODEL implements several flows (defined below), each having their own CoDel AQM.\",\n\t\t\t\"parameters\" => array(\n\t\t\t\t\"target\" => array(\"name\" => \"Target Delay (ms)\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.target\")) / 1000),\n\t\t\t\t\"interval\" => array(\"name\" => \"Interval (ms)\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.interval\")) / 1000),\n\t\t\t\t\"quantum\" => array(\"name\" => \"quantum\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.quantum\")),\n\t\t\t\t\"limit\" => array(\"name\" => \"limit\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.limit\")),\n\t\t\t\t\"flows\" => array(\"name\" => \"flows\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.flows\"))\n\t\t\t),\n\t\t\t\"ecn\" => true\n\t\t),\n\t\t\"fq_pie\" => array(\n\t\t\t\"name\" => \"FQ_PIE\",\n\t\t\t\"parameter_format\" => \"type fq_pie target %sms tupdate %sms alpha %s beta %s max_burst %s max_ecnth %s quantum %s limit %s flows %s\",\n\t\t\t\"description\" => \"Fair Queue Proportional Integral controller Enhanced AQM (FQ_PIE) is similar to FQ_CODEL but uses a slightly different algorithm.\",\n\t\t\t\"parameters\" => array(\n\t\t\t\t\"target\" => array(\"name\" => \"Target Delay (ms)\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.target\")) / 1000),\n\t\t\t\t\"tupdate\" => array(\"name\" => \"Interval (ms)\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.tupdate\")) / 1000),\n\t\t\t\t\"alpha\" => array(\"name\" => \"alpha\", \"type\" => \"number step=any\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.alpha\")) / 1000),\n\t\t\t\t\"beta\" => array(\"name\" => \"beta\", \"type\" => \"number step=any\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.beta\")) / 1000),\n\t\t\t\t\"max_burst\" => array(\"name\" => \"max_burst\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.max_burst\")) / 1000),\n\t\t\t\t\"max_ecnth\" => array(\"name\" => \"max_ecnth\", \"type\" => \"number step=any\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.max_ecnth\")) / 1000),\n\t\t\t\t\"quantum\" => array(\"name\" => \"quantum\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqpie.quantum\")),\n\t\t\t\t\"limit\" => array(\"name\" => \"limit\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqpie.limit\")),\n\t\t\t\t\"flows\" => array(\"name\" => \"flows\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqpie.flows\"))\n\t\t\t),\n\t\t\t\"ecn\" => true,\n\t\t\t\"pie_onoff\" => true,\n\t\t\t\"pie_capdrop\" => true,\n\t\t\t\"pie_qdelay\" => true,\n\t\t\t\"pie_pderand\" => true\n\t\t)\n\t);\n}", "protected function getSchedulerTimings(){\n return [\n 'start' => Config::where('name', '=', 'scheduler_start_time')->first()->value,\n 'end' => Config::where('name', '=', 'scheduler_end_time')->first()->value\n ];\n }", "public function testGetAllScheduledJobs()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "function run_jobs($jobs)\n{\n global $bb_cfg, $tr_cfg, $datastore;\n\n define('IN_CRON', true);\n\n $sql = \"SELECT cron_script FROM \" . BB_CRON . \" WHERE cron_id IN ($jobs)\";\n if (!$result = DB()->sql_query($sql)) {\n bb_die('Could not obtain cron script');\n }\n\n while ($row = DB()->sql_fetchrow($result)) {\n $job = $row['cron_script'];\n $job_script = INC_DIR . 'cron/jobs/' . $job;\n require($job_script);\n }\n DB()->query(\"\n\t\t\tUPDATE \" . BB_CRON . \" SET\n\t\t\t\tlast_run = NOW(),\n\t\t\t\trun_counter = run_counter + 1,\n\t\t\t\tnext_run =\n\t\t\tCASE\n\t\t\t\tWHEN schedule = 'hourly' THEN\n\t\t\t\t\tDATE_ADD(NOW(), INTERVAL 1 HOUR)\n\t\t\t\tWHEN schedule = 'daily' THEN\n\t\t\t\t\tDATE_ADD(DATE_ADD(CURDATE(), INTERVAL 1 DAY), INTERVAL TIME_TO_SEC(run_time) SECOND)\n\t\t\t\tWHEN schedule = 'weekly' THEN\n\t\t\t\t\tDATE_ADD(\n\t\t\t\t\t\tDATE_ADD(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(NOW()) DAY), INTERVAL 7 DAY),\n\t\t\t\t\tINTERVAL CONCAT(ROUND(run_day-1), ' ', run_time) DAY_SECOND)\n\t\t\t\tWHEN schedule = 'monthly' THEN\n\t\t\t\t\tDATE_ADD(\n\t\t\t\t\t\tDATE_ADD(DATE_SUB(CURDATE(), INTERVAL DAYOFMONTH(NOW())-1 DAY), INTERVAL 1 MONTH),\n\t\t\t\t\tINTERVAL CONCAT(ROUND(run_day-1), ' ', run_time) DAY_SECOND)\n\t\t\t\tELSE\n\t\t\t\t\tDATE_ADD(NOW(), INTERVAL TIME_TO_SEC(run_interval) SECOND)\n\t\t\tEND\n\t\t\tWHERE cron_id IN ($jobs)\n\t\t\");\n sleep(3);\n return;\n}", "public function getCurrentlyScheduled() : array\n {\n $now = new DrupalDateTime('now', $this->getTimezone());\n $now = $now->format(DATETIME_STORAGE_FORMAT);\n\n $query = \\Drupal::entityQuery('node')\n ->condition('type', 'scheduled_content_2')\n ->condition('field_schedule_start_time', $now, '<=')\n ->condition('field_schedule_end_time', $now, '>=')\n ->sort('field_schedule_start_time', 'DESC')\n ->accessCheck(false)\n ;\n\n return Node::loadMultiple($query->execute());\n }", "public static function getSchedules() {\n $client = self::getClient();\n $session = Session::get('session');\n // $rootSession = $client->getRoot\n $contact = Session::get('contact');\n\n $params = array(\n 'session' => $session->root_session_id,\n 'student_id' => $contact->id,\n );\n\n $result = $client->call(SugarMethod::GET_SCHEDULES, $params);\n\n return $result;\n }", "public function check()\n {\n $res = [];\n $crash_time = $this->getOption('crash_time');\n\n if ($crash_time) {\n $sql = 'SELECT *\n\t\t\t\t FROM ' . $this->getOption('table') . '\n\t\t\t\t WHERE UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(start_exec) > ? AND active = ?';\n\n $rs = $this->db->query($sql, [$crash_time, 1]);\n\n foreach ($rs as $ar) {\n $ar['message'] = 'Cron job crashed [' . $ar['handler_spec'] . ']';\n $ar['vars'] = mb_strlen($ar['vars']) ? unserialize($ar['vars']) : null;\n\n $this->spec->callHandler($this->getOption('crash_callback'), [$ar]);\n\n $this->db->exec('UPDATE ' . $this->getOption('table') . '\n SET start_process=null, start_exec=null\n WHERE id=?', [$ar[\"id\"]]);\n\n $res[] = $ar['id'];\n }\n }\n\n return $res;\n }", "function schedules_get()\n\t{\n $search = array();\n $response = FALSE; \n \n $cache = Cache::get_instance();\n $response = $cache::get('schedules' . serialize($this->_args));\n\n if (!$response) {\n $response['_count'] = $this->model->count_results($this->_args);\n\n if ($response['_count'] > 0)\n {\n $response['data'] = $this->model->fetch($this->_args, TRUE)->result();\n } \n $response['l'] = $this->db->last_query(); \n //$cache::save('schedule_h' . serialize($this->_args), $response);\n }\n\n $this->response($response);\n\t}", "public static function setScheduleJob()\n {\n return [\n [\n 'class' => 'backend\\modules\\helpdesk\\job\\StatsConversation',\n 'interval' => TimeUtil::SECONDS_OF_DAY,\n 'executeAt' => 'Y-m-d 00:00:01'\n ]\n ];\n }", "public function schedule()\n {\n return $this->morphMany('App\\Models\\CronJob', 'entity');\n }", "public function getSchedules() {\n\n\t\t$schedules = new HMBKP_Schedules();\n\t\t$array = array();\n\n\t\tforeach ( $schedules->get_schedules() as $schedule )\n\t\t\t$array[] = array( 'id' => $schedule->get_id(), 'next_run_date' => $schedule->get_next_occurrence() );\n\n\t\treturn $array;\n\t}", "public function cronrounds(){\n\t\t$seasons = SoccerAPI::seasons()->all();\n\t\t$rounds = array();\n\t\tforeach($seasons->data as $season){\n\t\t\tif($season->is_current_season==1){\n\t\t\t\t\t$rounds = SoccerAPI::rounds()->bySeasonId($season->id)->data;\n\t\t\t\t\tif(count($rounds)>0){\n\t\t\t\t\t\tforeach($rounds as $round){\n\t\t\t\t\t\t\t$date = date('Y-m-d');\n\t\t\t\t\t\t\t$to = date('Y-m-d', strtotime($date. ' + 90 days'));\n\t\t\t\t\t\t\tif(($round->start<$to)){\n\t\t\t\t\t\t\t\t$issetrounds = DB::select('SELECT * FROM match_weeks WHERE api_id=\"'.$round->id.'\"');\n\t\t\t\t\t\t\t\tif(!$issetrounds){\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tDB::table('match_weeks')->insert([\n\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'title_he' => 'מחזור '.$round->name,\n\t\t\t\t\t\t\t\t\t\t'title_en' => 'week '.$round->name,\n\t\t\t\t\t\t\t\t\t\t'created_at' => date('Y-m-d H:i:s'),\n\t\t\t\t\t\t\t\t\t\t'updated_at' => date('Y-m-d H:i:s'),\n\t\t\t\t\t\t\t\t\t\t'league_id' => $round->league_id,\n\t\t\t\t\t\t\t\t\t\t'start' => $round->start,\n\t\t\t\t\t\t\t\t\t\t'end' => $round->end,\n\t\t\t\t\t\t\t\t\t\t'api_id' => $round->id\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\texit;\n\t}", "public function getJobs() {\n $this->markTestIncomplete(\n 'This test has not been implemented yet.'\n );\n }", "public function do_cron(){\n if( !static::SKIP_CRON ){\n foreach( $this->get_results() as $result ){\n $this->parse_row($result);\n }\n }\n }", "function nsp_GetSchedules() {\n $schedules = wp_get_schedules();\n uasort( $schedules, create_function( '$a, $b', 'return $a[\"interval\"] - $b[\"interval\"];' ) );\n return $schedules;\n}", "public function draftSchedules()\n {\n return $this->hasMany('App\\Models\\CronJob', 'parent_id')\n ->where('parent_type', '=', get_class($this))\n ->where('entity_id', '!=', $this->revision_id)\n ->where('command', 'LIKE', 'cron:draft-online%');\n }", "public function getSchedule() : array\n {\n $scheduleConfig = [];\n $userSchedule = $this->config->item('schedule');\n $userSchedule = is_array($userSchedule) ? $userSchedule : [];\n\n if ($userSchedule) {\n $scheduleConfig['user'] = $userSchedule;\n }\n\n $providerSchedule = array_map(\n static function (Addon $addOn) {\n $provider = $addOn->getProvider();\n $schedule = $provider->get('schedule');\n $schedule = is_array($schedule) ? $schedule : [];\n\n if (! $schedule) {\n return false;\n }\n\n return $schedule;\n },\n $this->addOnFactory->installed()\n );\n\n $providerSchedule = array_filter($providerSchedule, static function ($i) {\n return $i !== false;\n });\n\n $scheduleConfig = array_merge($scheduleConfig, $providerSchedule);\n\n $commandGroups = $this->commandsService->getCommandGroups();\n\n $namesToQuery = [];\n $scheduleModels = [];\n\n foreach ($scheduleConfig as $sourceName => $config) {\n foreach ($config as $scheduleConfigItem) {\n $groupName = $scheduleConfigItem['group'] ?? '';\n $command = $scheduleConfigItem['command'] ?? '';\n $group = $commandGroups[$groupName] ?? '';\n\n /** @var CommandModel $commandModel */\n $commandModel = $group[$command] ?? null;\n\n if (! $commandModel) {\n continue;\n }\n\n $arguments = [\n 'ee',\n $groupName,\n $command,\n ];\n\n foreach ($scheduleConfigItem['arguments'] ?? [] as $key => $val) {\n $arguments[] = '--' . $key . '=' . $val;\n }\n\n $commandModel->setCustomCliArgumentsModel(\n $this->cliArgumentsModelFactory->make($arguments)\n );\n\n $model = $this->scheduleItemModelFactory->make();\n\n $model->setSource($sourceName);\n $model->setGroup($groupName);\n $model->setCommand($command);\n $model->setRunEvery($scheduleConfigItem['runEvery'] ?? 'Always');\n $model->setCommandModel($commandModel);\n\n $namesToQuery[] = $model->getName();\n $scheduleModels[$model->getName()] = $model;\n }\n }\n\n if ($namesToQuery) {\n $query = $this->queryBuilderFactory->make()\n ->where_in('name', $namesToQuery)\n ->get('executive_schedule_tracking')\n ->result();\n\n foreach ($query as $item) {\n /** @var ScheduleItemModel $model */\n $model = $scheduleModels[$item->name] ?? null;\n\n if (! $model) {\n continue;\n }\n\n $model->setId($item->id);\n $model->setRunning($item->isRunning);\n $model->setLastRunStartTime($item->lastRunStartTime);\n $model->setLastRunEndTime($item->lastRunEndTime);\n }\n }\n\n return array_values($scheduleModels);\n }", "function cron_run_scheduled_tasks(int $timenow) {\n // Allow a restriction on the number of scheduled task runners at once.\n $cronlockfactory = \\core\\lock\\lock_config::get_lock_factory('cron');\n $maxruns = get_config('core', 'task_scheduled_concurrency_limit');\n $maxruntime = get_config('core', 'task_scheduled_max_runtime');\n\n $scheduledlock = null;\n for ($run = 0; $run < $maxruns; $run++) {\n if ($scheduledlock = $cronlockfactory->get_lock(\"scheduled_task_runner_{$run}\", 1)) {\n break;\n }\n }\n\n if (!$scheduledlock) {\n mtrace(\"Skipping processing of scheduled tasks. Concurrency limit reached.\");\n return;\n }\n\n $starttime = time();\n\n // Run all scheduled tasks.\n while (!\\core\\task\\manager::static_caches_cleared_since($timenow) &&\n $task = \\core\\task\\manager::get_next_scheduled_task($timenow)) {\n cron_run_inner_scheduled_task($task);\n unset($task);\n\n if ((time() - $starttime) > $maxruntime) {\n mtrace(\"Stopping processing of scheduled tasks as time limit has been reached.\");\n break;\n }\n }\n\n // Release the scheduled task runner lock.\n $scheduledlock->release();\n}", "public function index() {\n\n\t\t$this->load->model('tool/ka_tasks');\n\t\t$this->model_tool_ka_tasks->logMessage(\"Task Scheduler: started\");\n\n\t\tif (!$this->user->isLogged() && (empty($this->request->get['key']) || \n\t\t\t$this->request->get['key'] != $this->config->get('ka_ts_run_scheduler_key'))\n\t\t) {\n\t\t\techo \"Task Scheduler: wrong key.\";\n\t\t\t$this->model_tool_ka_tasks->logMessage(\"WARNING: key is not valid or not found\");\n\t\t\treturn;\n\t\t}\n\n\t\t$sql_now = $this->model_tool_ka_tasks->getSqlNow();\n\t\t\n\t\t$this->last_scheduler_run = strtotime($this->model_tool_ka_tasks->getConfigHidden('ka_ts_last_scheduler_run'));\n\t\t$this->model_tool_ka_tasks->setConfigHidden('ka_ts_last_scheduler_run', $sql_now);\n\n\t\t//\n\t\t// STAGE 1: find a task to run\n\t\t//\n\n\t\t$task_id = (isset($this->request->get['task_id'])) ? $this->request->get['task_id']:0;\n\t\t$this->current_task = $current_task = $this->fetchTask($task_id);\n\t\t\n\t\t// scheduler does not have any active tasks or they do not require start now\n\t\t//\n\t\tif (empty($current_task)) {\n\t\t\t$this->model_tool_ka_tasks->logMessage($msg = \"Task Scheduler: \" . $this->last_error);\n\t\t\techo $msg;\n\t\t \treturn false;\n\t\t}\n\t\t\n\t\t$this->model_tool_ka_tasks->logMessage(\"Task Scheduler: fetched task: taskid = $current_task[task_id], task module $current_task[module]\");\n\n\t\t//\n\t\t// STAGE 2: run the found task\n\t\t//\n\t\t\n\t\t// mark the task as started\n\t\t//\n\t\tif ($current_task['run_status'] == 'not_started') {\n\t\t\t$this->db->query(\"UPDATE \" . DB_PREFIX . \"ka_tasks SET \n\t\t\t\tfirst_run = NOW(), run_count = 0 \n\t\t\t\tWHERE task_id = '$current_task[task_id]'\"\n\t\t\t);\n\t\t\t$this->model_tool_ka_tasks->setConfigHidden('ka_ts_last_task_id', $current_task['task_id']);\n\t\t}\n\t\t\n\t\t// check if the task can realy start\n\t\t//\n\t\tif (!$this->model_tool_ka_tasks->isSchedulerModel($current_task['module'])) {\n\t\t\t$this->model_tool_ka_tasks->changeTaskStatus($current_task['task_id'], 'not_started');\t\t\t\n\t\t\n\t\t\t$this->model_tool_ka_tasks->logMessage($msg = \"WARNING: module $current_task[module] cannot be uploaded, it is not compatible with Task Scheduler API\");\n\t\t\t$this->log->write($msg);\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->old_session_data = $this->session->data;\n\t\t\n\t\t$session = new Session();\n\t\t$this->registry->set('session', $session);\n\t\t\n\t\tif (empty($current_task['run_status']) || $current_task['run_status'] == 'not_started') {\n\t\t\t$stat = array();\n\t\t\t$session->data['token'] = md5(mt_rand());\n\t\t\t\n\t\t} elseif ($current_task['run_status'] == 'not_finished') {\n\t\t\t$stat = $current_task['stat'];\n\t\t\t$this->session->data = unserialize($current_task['session_data']);\n\t\t\t\n\t\t} else {\n\t\t\t$this->model_tool_ka_tasks->changeTaskStatus($current_task['task_id'], 'not_started');\n\t\t\t$this->model_tool_ka_tasks->logMessage($e = \"ERROR: Unknown run_status ($current_task[run_status]). Reset to not_started.\");\n\t\t\ttrigger_error($e);\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$this->load->model($current_task['module']);\t\n\t\t$name = 'model_' . str_replace('/', '_', $current_task['module']);\n\n\t\tif (!is_object($this->$name)) {\n\t\t\t$this->model_tool_ka_tasks->logMessage($msg = \"WARNING: model $name cannot be uploaded for unkown reason. Model object does not exist.\");\n\t\t\t$this->log->write($msg);\n\t\t\t\n\t\t\t$this->model_tool_ka_tasks->changeTaskStatus($current_task['task_id'], 'not_started');\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// switch the task to 'working' status\n\t\t//\n\t\t$this->model_tool_ka_tasks->changeTaskStatus($current_task['task_id'], 'working');\n\n\t\t/*\n\t\t\tsupported results:\n\t\t\t\tarray(\n\t\t\t\t\t'result' - not_finished/finished;\n\t\t\t\t\t'next_task_id' - optional\n\t\t\t\t)\n\t\t\t\t\n\t\t\t\tstring - not_finished/finished\n\t\t\t\t\n\t\t\t$stat - should be received by reference and statistics results will be returned\n\t\t\t\t\tas a hash array.\n\t\t*/\n\t\t$next_task_id = 0;\t\t\n\t\t$res = '';\n\t\t\n\t\t$run_result = $this->$name->runSchedulerOperation($current_task['operation'], $current_task['params'], $stat);\n\t\tif (is_array($run_result)) {\n\t\t\t$res = $run_result['result'];\n\t\t\tif (isset($run_result['next_task_id'])) { \n\t\t\t\t$next_task_id = $run_result['next_task_id'];\n\t\t\t}\n\t\t} else {\n\t\t\t$res = $run_result;\n\t\t}\n\n\t\t//\n\t\t// STAGE 3: save results\n\t\t//\n\t\t \t\n\t\t$stat = serialize($stat);\n\t\t\t\n\t\t$complete_count_sql = '';\n\t\tif ($res == 'finished') {\n\t\t\t$session_data = '';\n\t\t\t$run_status = 'not_started';\n\t\t\t$complete_count_sql = \"complete_count = complete_count + 1,\";\n\t\t\t\n\t\t} elseif ($res == 'not_finished') {\n\t\t\t$session_data = serialize($this->session->data);\n\t\t\t$run_status = 'not_finished';\n\t\t\t\n\t\t} else {\n\t\t\t$this->model_tool_ka_tasks->logMessage($e = \"ERROR: Unknown function result ($res). Stopped.\");\n\t\t\ttrigger_error($e, E_USER_ERROR);\n\t\t}\n\t\t\n\t\t$this->session->data = $this->old_session_data;\n\t\t\n\t\t$this->db->query(\"UPDATE \" . DB_PREFIX . \"ka_tasks\n\t\t\tSET\n\t\t\t\tstat = '\" . $this->db->escape($stat) . \"',\n\t\t\t\tsession_data = '\" . $this->db->escape($session_data) . \"',\n\t\t\t\trun_status = '$run_status',\n\t\t\t\trun_count = run_count + 1,\n\t\t\t\t$complete_count_sql\n\t\t\t\tlast_run = now()\n\t\t\tWHERE\n\t\t\t\ttask_id = '$current_task[task_id]'\n\t\t\");\n\n\t\t//\n\t\t// STAGE 4: redict the page to the next run if required\n\t\t//\t\t\n\t\t$url = \"key=\" . $this->config->get('ka_ts_run_scheduler_key');\n\t\tif (!empty($this->session->data['token'])) {\n\t\t\t$url = $url . '&token=' . $this->session->data['token'];\n\t\t}\n\t\t\n\t\tif ($res == 'not_finished') {\n\t\t\t\n\t\t\t$location = $this->url->link('catalog/ka_run_scheduler', $url, 'SSL');\n\t\t\t$run_count = $this->current_task['run_count'] + 1;\n\t\t\t$this->model_tool_ka_tasks->logMessage(\"Task Scheduler: task is not finished, (run_count: $run_count) redirecting...\");\n\t\t\t$this->redirect_page($location);\n\n\t\t} elseif ($res == 'finished') {\n\t\t\t\n\t\t\t$task = $this->model_tool_ka_tasks->getTask($current_task['task_id'], true);\n\n\t\t\tif ($this->config->get('ka_ts_send_email_on_completion') == 'Y') {\n\t\t\t\t$ka_mail = new KaMail($this->registry);\n\t\t\t\t$ka_mail->data['task'] = $task;\n\t\t\t\n\t\t\t\t$ka_mail->send($this->config->get('config_email'), $this->config->get('config_email'),\n\t\t\t\t\t$this->language->get('Task is complete'), 'ka_task_complete.tpl'\n\t\t\t\t);\n\t\t\t}\n\t\t\t\n\t\t\t$this->model_tool_ka_tasks->logMessage($msg = \"Task Scheduler: task (id: $current_task[task_id]) is finished.\");\n\t\t\techo $msg . \"<br />\";\n\t\t\t\n\t\t\tif (!empty($next_task_id)) {\n\t\t\t\t$location = $this->url->link('catalog/ka_run_scheduler', $url . '&task_id=' . $next_task_id, 'SSL');\n\t\t\t\t$this->model_tool_ka_tasks->logMessage(\"Task Scheduler: Next task called (next_task_id: $next_task_id) redirecting...\");\n\t\t\t\t$this->redirect_page($location);\n\t\t\t}\n\t\t}\n\n\t\t$this->model_tool_ka_tasks->logMessage($msg = \"Task Scheduler: script ends.\");\n\t\techo $msg;\n \t}" ]
[ "0.7835303", "0.6897201", "0.6521642", "0.6270891", "0.6100281", "0.6082396", "0.60638905", "0.6042264", "0.60319877", "0.5825411", "0.5819866", "0.5807568", "0.57307124", "0.5719422", "0.56854963", "0.5673897", "0.5650697", "0.563053", "0.55791044", "0.55687255", "0.5555774", "0.5546336", "0.55395925", "0.55250096", "0.549943", "0.549505", "0.54851115", "0.54758936", "0.54653734", "0.546497" ]
0.7418887
1
This function takes a Scheduler object and uses its job_interval attribute to derive DBstandard datetime strings, as many as are qualified by its ranges. The times are from the time of calling the script.
function deriveDBDateTimes($focus) { global $timedate; $GLOBALS['log']->debug('deriveDBDateTimes got an object of type: '.$focus->object_name); /* [min][hr][dates][mon][days] */ $dateTimes = array(); $ints = explode('::', str_replace(' ','',$focus->job_interval)); $days = $ints[4]; $mons = $ints[3]; $dates = $ints[2]; $hrs = $ints[1]; $mins = $ints[0]; $today = getdate($timedate->getNow()->ts); // derive day part if($days == '*') { $GLOBALS['log']->debug('got * day'); } elseif(strstr($days, '*/')) { // the "*/x" format is nonsensical for this field // do basically nothing. $theDay = str_replace('*/','',$days); $dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $theDay); } elseif($days != '*') { // got particular day(s) if(strstr($days, ',')) { $exDays = explode(',',$days); foreach($exDays as $k1 => $dayGroup) { if(strstr($dayGroup,'-')) { $exDayGroup = explode('-', $dayGroup); // build up range and iterate through for($i=$exDayGroup[0];$i<=$exDayGroup[1];$i++) { $dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $i); } } else { // individuals $dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $dayGroup); } } } elseif(strstr($days, '-')) { $exDayGroup = explode('-', $days); // build up range and iterate through for($i=$exDayGroup[0];$i<=$exDayGroup[1];$i++) { $dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $i); } } else { $dayName[] = str_replace($focus->dayInt, $focus->dayLabel, $days); } // check the day to be in scope: if(!in_array($today['weekday'], $dayName)) { return false; } } else { return false; } // derive months part if($mons == '*') { $GLOBALS['log']->debug('got * months'); } elseif(strstr($mons, '*/')) { $mult = str_replace('*/','',$mons); $startMon = $timedate->fromTimestamp($focus->date_time_start)->month; $startFrom = ($startMon % $mult); for($i=$startFrom;$i<=12;$i+$mult) { $compMons[] = $i+$mult; $i += $mult; } // this month is not in one of the multiplier months if(!in_array($today['mon'],$compMons)) { return false; } } elseif($mons != '*') { if(strstr($mons,',')) { // we have particular (groups) of months $exMons = explode(',',$mons); foreach($exMons as $k1 => $monGroup) { if(strstr($monGroup, '-')) { // we have a range of months $exMonGroup = explode('-',$monGroup); for($i=$exMonGroup[0];$i<=$exMonGroup[1];$i++) { $monName[] = $i; } } else { $monName[] = $monGroup; } } } elseif(strstr($mons, '-')) { $exMonGroup = explode('-', $mons); for($i=$exMonGroup[0];$i<=$exMonGroup[1];$i++) { $monName[] = $i; } } else { // one particular month $monName[] = $mons; } // check that particular months are in scope if(!in_array($today['mon'], $monName)) { return false; } } // derive dates part if($dates == '*') { $GLOBALS['log']->debug('got * dates'); } elseif(strstr($dates, '*/')) { $mult = str_replace('*/','',$dates); $startDate = $timedate->fromTimestamp($focus->date_time_start)->day; $startFrom = ($startDate % $mult); for($i=$startFrom; $i<=31; $i+$mult) { $dateName[] = str_pad(($i+$mult),2,'0',STR_PAD_LEFT); $i += $mult; } if(!in_array($today['mday'], $dateName)) { return false; } } elseif($dates != '*') { if(strstr($dates, ',')) { $exDates = explode(',', $dates); foreach($exDates as $k1 => $dateGroup) { if(strstr($dateGroup, '-')) { $exDateGroup = explode('-', $dateGroup); for($i=$exDateGroup[0];$i<=$exDateGroup[1];$i++) { $dateName[] = $i; } } else { $dateName[] = $dateGroup; } } } elseif(strstr($dates, '-')) { $exDateGroup = explode('-', $dates); for($i=$exDateGroup[0];$i<=$exDateGroup[1];$i++) { $dateName[] = $i; } } else { $dateName[] = $dates; } // check that dates are in scope if(!in_array($today['mday'], $dateName)) { return false; } } // derive hours part //$startHour = date('G', strtotime($focus->date_time_start)); //$currentHour = ($startHour < 1) ? 23 : date('G', strtotime($focus->date_time_start)); $currentHour = $timedate->getNow()->hour; if($hrs == '*') { $GLOBALS['log']->debug('got * hours'); for($i=0;$i<=24; $i++) { if($currentHour + $i > 23) { $hrName[] = $currentHour + $i - 24; } else { $hrName[] = $currentHour + $i; } } } elseif(strstr($hrs, '*/')) { $mult = str_replace('*/','',$hrs); for($i=0; $i<24; $i) { // weird, i know if($currentHour + $i > 23) { $hrName[] = $currentHour + $i - 24; } else { $hrName[] = $currentHour + $i; } $i += $mult; } } elseif($hrs != '*') { if(strstr($hrs, ',')) { $exHrs = explode(',',$hrs); foreach($exHrs as $k1 => $hrGroup) { if(strstr($hrGroup, '-')) { $exHrGroup = explode('-', $hrGroup); for($i=$exHrGroup[0];$i<=$exHrGroup[1];$i++) { $hrName[] = $i; } } else { $hrName[] = $hrGroup; } } } elseif(strstr($hrs, '-')) { $exHrs = explode('-', $hrs); for($i=$exHrs[0];$i<=$exHrs[1];$i++) { $hrName[] = $i; } } else { $hrName[] = $hrs; } } // derive minutes $currentMin = $timedate->getNow()->minute; if(substr($currentMin, 0, 1) == '0') { $currentMin = substr($currentMin, 1, 1); } if($mins == '*') { $GLOBALS['log']->debug('got * mins'); for($i=0; $i<60; $i++) { if(($currentMin + $i) > 59) { $minName[] = ($i + $currentMin - 60); } else { $minName[] = ($i+$currentMin); } } } elseif(strstr($mins,'*/')) { $mult = str_replace('*/','',$mins); $startMin = $timedate->fromTimestmp($focus->date_time_start)->minute; $startFrom = ($startMin % $mult); for($i=$startFrom; $i<=59; $i+$mult) { if(($currentMin + $i) > 59) { $minName[] = ($i + $currentMin - 60); } else { $minName[] = ($i+$currentMin); } $i += $mult; } } elseif($mins != '*') { if(strstr($mins, ',')) { $exMins = explode(',',$mins); foreach($exMins as $k1 => $minGroup) { if(strstr($minGroup, '-')) { $exMinGroup = explode('-', $minGroup); for($i=$exMinGroup[0]; $i<=$exMinGroup[1]; $i++) { $minName[] = $i; } } else { $minName[] = $minGroup; } } } elseif(strstr($mins, '-')) { $exMinGroup = explode('-', $mins); for($i=$exMinGroup[0]; $i<=$exMinGroup[1]; $i++) { $minName[] = $i; } } else { $minName[] = $mins; } } // prep some boundaries - these are not in GMT b/c gmt is a 24hour period, possibly bridging 2 local days if(empty($focus->time_from) && empty($focus->time_to) ) { $timeFromTs = 0; $timeToTs = strtotime('+1 day'); } else { $timeFromTs = strtotime($focus->time_from); // these are now GMT (timestamps are all GMT) $timeToTs = strtotime($focus->time_to); // see above if($timeFromTs > $timeToTs) { // we've crossed into the next day $timeToTs = strtotime('+1 day '. $focus->time_to); // also in GMT } } $timeToTs++; if(empty($focus->last_run)) { $lastRunTs = 0; } else { $lastRunTs = strtotime($focus->last_run); } // now smush the arrays together =) $validJobTime = array(); global $timedate; $dts = explode(' ',$focus->date_time_start); // split up datetime field into date & time $dts2 = $timedate->to_db_date_time($dts[0],$dts[1]); // get date/time into DB times (GMT) $dateTimeStart = $dts2[0]." ".$dts2[1]; $timeStartTs = strtotime($dateTimeStart); if(!empty($focus->date_time_end) && !$focus->date_time_end == '2021-01-01 07:59:00') { // do the same for date_time_end if not empty $dte = explode(' ', $focus->date_time_end); $dte2 = $timedate->to_db_date_time($dte[0],$dte[1]); $dateTimeEnd = $dte2[0]." ".$dte2[1]; } else { $dateTimeEnd = $timedate->getNow()->get('+1 day')->asDb(); // $dateTimeEnd = '2020-12-31 23:59:59'; // if empty, set it to something ridiculous } $timeEndTs = strtotime($dateTimeEnd); // GMT end timestamp if necessary $timeEndTs++; /*_pp('hours:'); _pp($hrName);_pp('mins:'); _pp($minName);*/ $nowTs = $timedate->getNow()->ts; // _pp('currentHour: '. $currentHour); // _pp('timeStartTs: '.date('r',$timeStartTs)); // _pp('timeFromTs: '.date('r',$timeFromTs)); // _pp('timeEndTs: '.date('r',$timeEndTs)); // _pp('timeToTs: '.date('r',$timeToTs)); // _pp('mktime: '.date('r',mktime())); // _pp('timeLastRun: '.date('r',$lastRunTs)); // // _pp('hours: '); // _pp($hrName); // _pp('mins: '); // _ppd($minName); $hourSeen = 0; foreach($hrName as $kHr=>$hr) { $hourSeen++; foreach($minName as $kMin=>$min) { if($hr < $currentHour || $hourSeen == 25) { $theDate = $timedate->asDbDate($timedate->getNow()->get('+1 day')); } else { $theDate = $timedate->nowDbDate(); } $tsGmt = strtotime($theDate.' '.str_pad($hr,2,'0',STR_PAD_LEFT).":".str_pad($min,2,'0',STR_PAD_LEFT).":00"); // this is LOCAL // _pp(date('Y-m-d H:i:s',$tsGmt)); if( $tsGmt >= $timeStartTs ) { // start is greater than the date specified by admin if( $tsGmt >= $timeFromTs ) { // start is greater than the time_to spec'd by admin if( $tsGmt <= $timeEndTs ) { // this is taken care of by the initial query - start is less than the date spec'd by admin if( $tsGmt <= $timeToTs ) { // start is less than the time_to if( $tsGmt >= $nowTs ) { // we only want to add jobs that are in the future if( $tsGmt > $lastRunTs ) { //TODO figure if this is better than the above check $validJobTime[] = $timedate->fromTimestamp($tsGmt)->asDb(); //_pp("Job Qualified for: ".date('Y-m-d H:i:s', $tsGmt)); } else { //_pp('Job Time is NOT greater than Last Run'); } } else { //_pp('Job Time is NOT larger than NOW'); _pp(date('Y-m-d H:i:s', $nowTs)); } } else { //_pp('Job Time is NOT smaller that TimeTO: '.$tsGmt .'<='. $timeToTs); } } else { //_pp('Job Time is NOT smaller that DateTimeEnd: '.date('Y-m-d H:i:s',$tsGmt) .'<='. $dateTimeEnd); _pp( $tsGmt .'<='. $timeEndTs ); } } else { //_pp('Job Time is NOT bigger that TimeFrom: '.$tsGmt .'>='. $timeFromTs); } } else { //_pp('Job Time is NOT Bigger than DateTimeStart: '.date('Y-m-d H:i',$tsGmt) .'>='. $dateTimeStart); } } } // _ppd(); // _ppd($validJobTime); return $validJobTime; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function retrieveSchedulers() {\n\t\t$GLOBALS['log']->info('Gathering Schedulers');\n\t\t$executeJobs = array();\n\t\t$query \t= \"SELECT id \" .\n\t\t\t\t\"FROM schedulers \" .\n\t\t\t\t\"WHERE deleted=0 \" .\n\t\t\t\t\"AND status = 'Active' \" .\n\t\t\t\t\"AND date_time_start < \".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\",'datetime').\" \" .\n\t\t\t\t\"AND (date_time_end > \".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\",'datetime').\" OR date_time_end IS NULL)\";\n\t\t\t\t\n\t\t$result\t= $this->db->query($query);\n\t\t$rows=0;\n\t\t$executeTimes = array();\n\t\t$executeIds = array();\n\t\t$executeJobTimes = array();\n\t\twhile(($arr = $this->db->fetchByAssoc($result)) != null) {\n\t\t\t$focus = BeanFactory::getBean('Schedulers', $arr['id']);\n\t\t\t$executeTimes[$rows] = $this->deriveDBDateTimes($focus);\n\t\t\tif(count($executeTimes) > 0) {\n\t\t\t\tforeach($executeTimes as $k => $time) {\n\t\t\t\t$executeIds[$rows] = $focus->id;\n\t\t\t\t\t$executeJobTimes[$rows] = $time;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$rows++;\n\t\t}\n\t\t$executeJobs['ids'] = $executeIds;\n\t\t$executeJobs['times'] = $executeJobTimes;\n\t\treturn $executeJobs;\n\t}", "private function setIntervals() {\r\n $this->interval = OPT_TREND_DAY;\r\n\r\n if (isset($this->requestParameters['interval'])) {\r\n $this->interval = $this->requestParameters['interval'];\r\n if (!in_array($this->interval, $this->available_intervals)) {\r\n throw new Exception(\"interval ($this->interval).\", 400004);\r\n }\r\n }\r\n\r\n switch ($this->interval) {\r\n case OPT_TREND_5MINUTE:\r\n case OPT_TREND_MINUTE:\r\n $val = $this->interval == OPT_TREND_5MINUTE ? 5 : 1;\r\n $this->datesub = 'PT' . $val * ($this->entries) . 'M';\r\n $this->dateadd = 'PT' . $val . 'M';\r\n break;\r\n case OPT_TREND_HOUR:\r\n $this->datesub = 'PT' . ($this->entries) . 'H';\r\n $this->dateadd = 'PT1H';\r\n break;\r\n default :\r\n $this->datesub = 'P' . ($this->entries - 1) . 'D';\r\n $this->dateadd = 'P1D';\r\n break;\r\n }\r\n }", "function insertSchedules() {\n\t\t$GLOBALS['log']->info('----->Scheduler retrieving scheduled items and adding them to Job queue.');\n\t\t$jobsArr = $this->retrieveSchedulers();\n\t\tif(is_array($jobsArr['ids']) && !empty($jobsArr['ids']) && is_array($jobsArr['times']) && !empty($jobsArr['times'])) {\n\t\t\tforeach($jobsArr['ids'] as $k => $ids) {\n\t\t\t\tforeach($jobsArr['times'][$k] as $j => $time) {\n\t\t\t\t\t$guid = create_guid();\n\t\t\t\t\t$q = \"INSERT INTO schedulers_times\n\t\t\t\t\t\t(id, deleted, date_entered, date_modified, scheduler_id, execute_time, status)\n\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'\".$guid.\"',\n\t\t\t\t\t\t0, \n\t\t\t\t\t\t\".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\", 'datetime').\",\n\t\t\t\t\t\t\".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\", 'datetime').\",\n\t\t\t\t\t\t'\".$jobsArr['ids'][$k].\"',\n\t\t\t\t\t\t\".db_convert(\"'\".$time.\"'\", 'datetime').\",\n\t\t\t\t\t\t'ready'\n\t\t\t\t\t\t)\";\n\t\t\t\t\t\t$this->db->query($q);\n\t\t\t\t\t$GLOBALS['log']->info('Query: '.$q);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private function generateCronJobs(){\n\t\t\n\t\t$jobs = \"\";\n\t\t\n\t\t$tmptime = $this->getUnixTime()-$this->hoursDelay*3600;\n\t\t//echo $tmptime . \",\" . time() . \"<hr>\";\n\t\t$timestart=0;\n\t\n\t\t//Classify the item depending on the time left.\n\t\t//Normalized time start.\n\t\tif(($tmptime-time())>43200) // >12h\n\t\t{\n\t\t\t$type = 1;\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=43200;\n\t\t\t$timestart-=43200;\n\t\t}\n\t\telseif(($tmptime-time())<=43200 && ($tmptime-time())>21600) // <=12h & >=6h\n\t\t{\n\t\t\t$type = 2;\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=21600;\n\t\t\t$timestart-=21600;\n\t\t}\n\t\telseif(($tmptime-time())<=21600 && ($tmptime-time())>7200) // <=6h & >=2h\n\t\t{\n\t\t\t$type = 3;\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=7200;\n\t\t\t$timestart-=7200;\n\t\t}\n\t\telseif(($tmptime-time())<=7200 && ($tmptime-time())>0) // <=2h\n\t\t{\n\t\t\t$type = 4;\t\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=1800;\n\t\t\t$timestart-=1800;\n\t\t}\n\t\t\n\t\tswitch($type){\n\t\t\tcase 1: // >12h\n\t\t\t\twhile($timestart-43200-12*3600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=43200;\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase 2: // <=12h & >=6h. 1 cronjob every 6 hours\n\t\t\t\twhile($timestart-6*3600-6*3600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=6*3600;\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase 3: // <=6h & >=2h. 1 cronjob every 60min\n\t\t\t\twhile($timestart-3600-2*3600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=3600;\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase 4: // <=2h. 1 cronjob every 30min\n\t\t\t\twhile($timestart-1800-1800>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=1800;\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\twhile($timestart-600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=600;\n\t\t\t\t}\n\t\t}\n\t\n\t\treturn $jobs;\n\t\n\t}", "protected function getSchedulerTimings(){\n return [\n 'start' => Config::where('name', '=', 'scheduler_start_time')->first()->value,\n 'end' => Config::where('name', '=', 'scheduler_end_time')->first()->value\n ];\n }", "function get_lunch_schedule($schedtype,$gc_start_break,$sched_break_start,$gc_end_break,$sched_break_end,$start_break_partner,$end_break_partner,$sched_to,$actual_timeout,$employee_idno,$date_timelog){\n\t//------------------$gc_end_break - lunch start\n\t//-------------------$gc_start_break - lunch end\n\t//--baligtad\n\t$trs = get_instance();\n\t$trs->load->model('time_record/Timerecordsummary_model');\n\t\t$ded1 = 0;\n\t\t$ded2 = 0;\n\t\t$fix_lunch_break = 0;\n\t\t$lunch_deduction = 0;\n\t\t//-----------LUNCH DEDUCTION / OVERBREAK--------------------------\n\t\t//early out\n\t\tif($gc_start_break <= $sched_break_start){\n\t\t\t$x = $gc_start_break - $sched_break_start;\n\t\t\t$ded1 = $ded1 + $ded2;\n\t\t}\n\t\t//late in\n\t\tif($gc_end_break >= $sched_break_end){\n\t\t\t$y = $gc_end_break -$sched_break_end;\n\t\t\t$ded2 = $ded2 + $y;\n\t\t}\n\t\t//checks if start or end break of employee is greater than his actual time out\n\t\tif($gc_start_break > $sched_to || $gc_end_break > $sched_to){\n\t\t\t$lunch_deduction = 0;\n\t\t}else{\n\t\t\t//\n\t\t\t$lunch_deduction = $ded1 + $ded2;\n\t\t}\n\t\t// $lunch_deduction = $ded1 + $ded2;\n\n\t\t// $one = date('H:i', mktime(0,$gc_start_break));\n\t\t// $two = date('H:i', mktime(0,$start_break_partner));\n\t\t// $three = date('H:i', mktime(0,$gc_end_break));\n\t\t// $four = date('H:i', mktime(0,$end_break_partner));\n\t\t// print_r(array(\n\t\t// \t'start_break' => $one,\n\t\t// \t'start_partner' => $two,\n\t\t// \t'end_break' => $three,\n\t\t// \t'end_break_partner' => $four\n\t\t// ));\n\n\n\t\t// print_r(array('start' => $start_break_partner, 'sched' => $sched_break_start));\n\t\t//----FIX LUNCH BREAK------------------\n\t\tif(($gc_start_break > $sched_break_start) && ($start_break_partner < $sched_break_start)){\n\t\t\t$fix_lunch_break = $fix_lunch_break + ($gc_start_break - $sched_break_start);\n\t\t}\n\t\telse{\n\t\t\t$fix_lunch_break = $fix_lunch_break + 0;\n\t\t}\n\t\tif(($gc_end_break < $sched_break_end)){\n\t\t\t$fix_lunch_break = $fix_lunch_break + ($sched_break_end - $gc_end_break);\n\t\t}else{\n\t\t\t$fix_lunch_break = $fix_lunch_break + 0;\n\t\t}\n\t\t//checks if employee is half day\n\t\tif(($actual_timeout == $gc_start_break) && ($actual_timeout < $sched_break_end)){\n\t\t\t$fix_lunch_break = $fix_lunch_break\t+ ($gc_start_break - $gc_end_break);\n\t\t}\n\t\t//checks if start or end break of employee is greater than his actual time out\n\t\tif($gc_start_break > $sched_to || $gc_end_break > $sched_to){\n\t\t\t$fix_lunch_break = 0;\n\t\t}else{\n\t\t\t$fix_lunch_break = $fix_lunch_break;\n\t\t}\n\t\t//will check if time record exist in work order. if workorder exist, it will remove the overbreak of employee\n\t\t$breakout_hhmm = date('H:i', mktime(0,$gc_start_break));\n\t\t$check_workorder = $trs->Timerecordsummary_model->check_lunch_workorder($employee_idno,$date_timelog,$breakout_hhmm)->row();\n\t\tif($check_workorder != null){\n\t\t\t$et = convert_to_minutes($check_workorder->end_time);\n\t\t\tif($et > $sched_break_end){\n\t\t\t\t$overbreak_deduct = $et - $sched_break_end;\n\t\t\t\t$fix_lunch_break = $fix_lunch_break - $lunch_deduction;\n\t\t\t\t$lunch_deduction = $lunch_deduction - $overbreak_deduct;\n\n\t\t\t}\n\t\t}\n\t\t$getbreaks = array(\n\t\t\t'fix_lunch_break' => $fix_lunch_break,\n\t\t\t'lunch_deduction' => $lunch_deduction\n\t\t);\n\t\treturn $getbreaks;\n}", "protected function getDateRange()\n {\n $format = $this->arguments['format'];\n $endFormat = $this->arguments['endFormat'];\n $startFormat = $this->arguments['startFormat'];\n $glue = $this->arguments['glue'];\n\n if ($format === '') {\n $format = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] ?: 'Y-m-d';\n }\n if (empty($startFormat)) {\n $startFormat = $format;\n }\n if (empty($endFormat)) {\n $endFormat = $format;\n }\n\n if (strpos($startFormat, '%') !== false\n && strpos($endFormat, '%' !== false)\n ) {\n $dateRange = strftime($startFormat, $this->performance->getDate()->getTimestamp());\n $dateRange .= $glue . strftime($endFormat, $this->performance->getEndDate()->getTimestamp());\n } else {\n if ($endDate = $this->performance->getEndDate()) {\n $dateRange = $this->performance->getDate()->format($startFormat);\n $dateRange .= $glue . $endDate->format($endFormat);\n } else {\n $dateRange = $this->performance->getDate()->format($format);\n }\n }\n\n return $dateRange;\n }", "public function getScheduleTimes();", "public static function schedule_builder()\n {\n $sched = \"Mon: \" . self::schedule_timer() . \", Tue: \" . self::schedule_timer() . \", Wed: \" . self::schedule_timer() . \", Thu: \" . self::schedule_timer()\n . \", Fri: \" . self::schedule_timer() . \", Sat: \" . self::schedule_timer() . \", Sun: \" . self::schedule_timer();\n return $sched;\n }", "protected function createInterval() {\n\n\n $sString = $this->sInterval;\n $aPartsInterval = explode(\" \", $sString);\n foreach ($aPartsInterval as $iIndex => $sInterval) {\n\n if (in_array($sInterval, DBInterval::$aYearsString)) {\n $this->setYear($aPartsInterval[$iIndex -1]);\n }\n\n if (in_array($sInterval, DBInterval::$aMonthsString)) {\n $this->setMonths($aPartsInterval[$iIndex -1]);\n }\n\n if (in_array($sInterval, DBInterval::$aDaysString)) {\n $this->setDays($aPartsInterval[$iIndex -1]);\n }\n }\n\n }", "private static function human_interval( $interval ) {\n\t\t// array of time period chunks\n\t\t$chunks = array(\n\t\t\tarray( 60 * 60 * 24 * 365 , _n_noop( '%s year', '%s years', 'action-scheduler' ) ),\n\t\t\tarray( 60 * 60 * 24 * 30 , _n_noop( '%s month', '%s months', 'action-scheduler' ) ),\n\t\t\tarray( 60 * 60 * 24 * 7, _n_noop( '%s week', '%s weeks', 'action-scheduler' ) ),\n\t\t\tarray( 60 * 60 * 24 , _n_noop( '%s day', '%s days', 'action-scheduler' ) ),\n\t\t\tarray( 60 * 60 , _n_noop( '%s hour', '%s hours', 'action-scheduler' ) ),\n\t\t\tarray( 60 , _n_noop( '%s minute', '%s minutes', 'action-scheduler' ) ),\n\t\t\tarray( 1 , _n_noop( '%s second', '%s seconds', 'action-scheduler' ) ),\n\t\t);\n\n\t\tif ( $interval <= 0 ) {\n\t\t\treturn __( 'Now!', 'action-scheduler' );\n\t\t}\n\n\t\t// Step one: the first chunk\n\t\tfor ( $i = 0, $j = count( $chunks ); $i < $j; $i++ ) {\n\t\t\t$seconds = $chunks[$i][0];\n\t\t\t$name = $chunks[$i][1];\n\n\t\t\tif ( ( $count = floor( $interval / $seconds ) ) != 0 ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t$output = sprintf( _n( $name[0], $name[1], $count, 'action-scheduler' ), $count );\n\n\t\tif ( $i + 1 < $j ) {\n\t\t\t$seconds2 = $chunks[$i + 1][0];\n\t\t\t$name2 = $chunks[$i + 1][1];\n\n\t\t\tif ( ( $count2 = floor( ( $interval - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) {\n\t\t\t\t// add to output var\n\t\t\t\t$output .= ' '.sprintf( _n( $name2[0], $name2[1], $count2, 'action-scheduler' ), $count2 );\n\t\t\t}\n\t\t}\n\n\t\treturn $output;\n\t}", "function getStartEndCrontabDate($timestampStart, $timestampEnd)\n{\n global $CRONSTEP;\n\n $result = array( \"start\" => 0, \"end\" => 0 );\n\n $result[\"start\"] = date('YmdHi', addTime($timestampStart, $CRONSTEP));\n $result[\"end\"] = date('YmdHi', addTime($timestampEnd, $CRONSTEP));\n\n return $result;\n}", "public function getJobsBetweenDates($start, $end){\r\n\t\t$sql = \"SELECT\r\n\t\t`customer_table`.`customer_name`,\r\n\t\t`job_table`.`product_name`,\r\n\t\t`job_table`.`job_description`,\r\n\t\tCONCAT(`job_table`.`date_submitted`, ' ', `job_table`.`time_submitted`) AS `datetime_submitted`,\r\n\t\t`job_table`.`last_updated`,\r\n\t\t`job_table`.`progress`,\r\n\t\t`job_table`.`urgency`\r\n\t\tFROM `job_table`\r\n\t\tLEFT JOIN `customer_table`\r\n\t\tON `job_table`.`customer_id` = `customer_table`.`customer_id`\r\n\t\tWHERE (`job_table`.`date_submitted` BETWEEN '\".$start.\"' AND '\".$end.\"') AND `job_table`.`shop_id` = $_SESSION[shopID]\r\n\t\tORDER BY `job_table`.`urgency` DESC \";\r\n\r\n\t\treturn $this->fetchAssoc($sql);\r\n\t}", "protected function getValidTimeRange()\n {\n $order2ECCmdLog = CommandLog::where('command_name', OrderEC2DB::class)->first();\n $ec2PosCmdLog = CommandLog::where('command_name', OrderDB2POS::class)->first();\n\n $start = !empty($ec2PosCmdLog) ? $ec2PosCmdLog['last_succeed_time'] : '';\n $end = !empty($order2ECCmdLog) ? $order2ECCmdLog['last_succeed_time'] : '';\n\n return [\n 'start' => $start,\n 'end' => $end\n ];\n }", "function get_sched_Costs()\n\t {\n\t\t$report_query = \" select \";\n\t\t$report_query .= \" round(sum(e.hourly_rate * ss.slength *(1+ 0.2 * ss.hour_after_midnight)),2) cost \";\n\t\t$report_query .= \" from schedule s, \"; \n\t\t$report_query .= \" employees e, \"; \n\t\t$report_query .= \" (select ss.slength, ss.shiftid, \"; \n\t\t$report_query .= \" case when HOUR(ADDTIME(STR_TO_DATE(ss.sfrom, '%h:%i %p') , SEC_TO_TIME(ss.slength*3600))) >24 \";\n\t\t$report_query .= \" then 1 \";\n\t\t$report_query .= \" else 0 end hour_after_midnight\t \";\t\t\t \n\t\t$report_query .= \" from shifts ss) ss \";\n\t\t$report_query .= \" where e.empid = s.empid \"; \n\t\t$report_query .= \" and ss.shiftid = s.shiftid \"; \n\t \n\t \n\t\tif (!($result = mysql_query($report_query)))\n\t {\n\t\t $msg = 'MySQL error #' . mysql_errno() . \": \" . mysql_error();\n\t\t echo $msg; \n\t }\n\t else if (0 == mysql_num_rows($result))\n\t {\n\t\t printf(\"No data are available!\\n\");\n\t\t return false;\n\t }\n\t else\n\t {\n\n\t\t echo \"\\nTotal Scheduling Cost : \";\n\t\t while ($row = mysql_fetch_array($result))\n\t\t {\n\t\t\t$cost = $row[\"cost\"]; \n\t\t\techo \"| $ $cost |\\n\";\n\t\t }\n\t\t}\n\t}", "public function intervalHS($start,$finish)\n {\n\t\t$start = date(\"Y-m-d H:i:s\",$start);\n\t\t$finish = date(\"Y-m-d H:i:s\",$finish);\n\n\t\t$where= new Where();\n\t\t$where->between('start_date_time',$start,$finish);\n\t\t$resultSet = $this->binTable->select($where);\n\t\t$rows = array();\n\t\t\n\t\tforeach ($resultSet as $binTableModel){\n\t\t\t\t$rows[0][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch01,\n\t\t\t\t);\n\t\t\t\t$rows[1][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch02,\n\t\t\t\t);\n\t\t\t\t$rows[2][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch03,\n\t\t\t\t);\n\t\t\t\t$rows[3][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch04,\n\t\t\t\t);\n\t\t\t\t$rows[4][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch05,\n\t\t\t\t);\n\t\t\t\t$rows[5][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch06,\n\t\t\t\t);\n\t\t\t\t$rows[6][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch07,\n\t\t\t\t);\n\t\t\t\t$rows[7][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch08,\n\t\t\t\t);\n\t\t\t\t$rows[8][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch09,\n\t\t\t\t);\n\t\t\t\t$rows[9][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch10,\n\t\t\t\t);\n\t\t\t\t$rows[10][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch11,\n\t\t\t\t);\n\t\t\t\t$rows[11][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch12,\n\t\t\t\t);\n\t\t\t\t$rows[12][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch13,\n\t\t\t\t);\n\t\t\t\t$rows[13][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch14,\n\t\t\t\t);\n\t\t\t\t$rows[14][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch15,\n\t\t\t\t);\n\t\t\t\t$rows[15][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch16,\n\t\t\t\t);\n\t\t\t\t$rows[16][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch17,\n\t\t\t\t);\n\t\t\t\t$rows[17][]=array(\n\t\t\t\t\tstrtotime($binTableModel->start_date_time)*1000,\n\t\t\t\t\t(int)$binTableModel->ch18,\n\t\t\t\t);\n\t\t\t}\n\n\t\treturn \tJson::encode($rows);\n }", "public function getSchedule()\r\n {\r\n return '52,53,54 * * * *';\r\n }", "function getSeriesDataForMultiJobs($user_id, $jobIds, $startDateTime, $endDateTime, $interval = 0, $includeChangeNotes = true) {\n if ($interval == 1) {\n $q = Doctrine_Query::create()->select('r.Date, r.WPTJobId')->from('WPTResult r')\n ->whereIn('r.WPTJobId', $jobIds)\n ->andWhere('r.ValidationState < ?', 2)\n// ->andWhere('r.WPTJob.UserId = ?', $user_id)\n ->andWhere('r.AvgFirstViewFirstByte > 0')\n// ->andWhere('r.AvgFirstViewStartRender > 0')\n ->andWhere('r.AvgFirstViewDocCompleteTime > 0')\n ->andWhere('r.AvgFirstViewFullyLoadedTime> 0')\n ->andWhere('r.Date <= ?', $endDateTime)\n ->andWhere('r.Date >= ?', $startDateTime)\n ->orderBy('r.Date')->distinct('r.Date')\n ->setHydrationMode(Doctrine_Core::HYDRATE_ARRAY);\n\n $result = $q->fetchArray();\n $q->free(true);\n } else {\n $pointer = $startDateTime;\n $result = array();\n\n while ($pointer < $endDateTime) {\n $entry = array();\n $entry['Date'] = $pointer;\n $pointer += $interval;\n $result[] = $entry;\n }\n }\n if ( $includeChangeNotes ){\n $changeNotes = getChangeNoteData($user_id,$jobIds,$startDateTime,$endDateTime);\n foreach ($changeNotes as $note){\n $entry = array();\n $entry['Date'] = $note['Date'];\n $result[]=$entry;\n }\n }\n sort($result);\n\n return $result;\n}", "function checkPendingJobs() {\n\t\tglobal $sugar_config;\n\t\tglobal $timedate;\n\t\t\n\t\t$GLOBALS['log']->debug('');\n\t\t$GLOBALS['log']->debug('----->Scheduler checking for qualified jobs to run.');\n\t\tif(empty($this->db)) {\n\t\t\t$this->db = DBManagerFactory::getInstance();\n\t\t}\n\t\t\n\t\t$fireTimeMinus = $timedate->asDb($timedate->getNow()->get('-1 minute'));\n\t\t$fireTimePlus = $timedate->asDb($timedate->getNow()->get('+1 minute'));\n\n\t\t// collapse list of schedulers where \"catch_up\" is 0 and status is \"ready\" (not \"in progress, completed, etc.\");\n\t\t$q = 'UPDATE schedulers_times st\n\t\t\t\t\tSET st.status = \\'not run\\' \n\t\t\t\t\tWHERE st.execute_time < '.$this->db->convert($this->db->quoted($fireTimeMinus), 'datetime').'\n\t\t\t\t\tAND st.status = \\'ready\\' \n\t\t\t\t\tAND st.scheduler_id IN (SELECT s.id FROM schedulers s WHERE st.scheduler_id = s.id AND s.catch_up = 0)';\n\t\t$this->db->query($q);\n\t\t\n\t\t$q = 'SELECT DISTINCT st.id, st.scheduler_id, st.status, s.name, s.job FROM schedulers_times st\n\t\t LEFT JOIN schedulers s ON st.scheduler_id = s.id WHERE st.execute_time < '.$this->db->convert($this->db->quoted($fireTimeMinus), 'datetime').\n ' AND st.deleted=0 AND s.deleted=0 AND st.status=\\'ready\\' AND s.status=\\'Active\\' ORDER BY s.name';\n\t\t$r = $this->db->query($q);\n\t\t$count = 0;\n\n\t\twhile($a = $this->db->fetchByAssoc($r)) {\n\t\t\t\n\t\t\t$job = BeanFactory::newBean('SchedulersJobs');\n\t\t\t\n\t\t\t$paramJob = $a['scheduler_id'];\n\t\t\t$job->fire($sugar_config['site_url'].'/index.php?entryPoint=schedulers&type=job&job_id='.$paramJob.'&record='.$a['id']);\n\t\t\t$count++;\n\t\t}\n\n\n\t\tif($count < 1) {\n\t\t\t$GLOBALS['log']->debug('----->Scheduler has found 0 Jobs to fire');\n\t\t}\n\t}", "public function get_wpcron_jobs(): array\n {\n $times = [];\n $cron_jobs = _get_cron_array();\n foreach ($cron_jobs as $key => $task) {\n if (isset($task[$this->slug])) {\n $times[] = ['datetime' => get_date_from_gmt(date('Y-m-d H:i:s', $key), 'F j, Y H:i:s'), 'timestamp' => $key, 'job' => $task];\n }\n }\n return $times;\n }", "public function getSchedule() { }", "protected function _initCronJob(array &$config)\n {\n $dbTime = $this->_resource->getDbTime($config['goToDown']);\n $maxTime = new Zend_Date(null, Varien_Date::DATETIME_INTERNAL_FORMAT);\n $maxTime->setMinute(0)->setSecond(0);\n\n $this->_isCron = true;\n $this->_jobDirection = false;\n\n if ($config['goToDown']) {\n //reverse direction aggregation\n $start = new Zend_Date($dbTime, Varien_Date::DATETIME_INTERNAL_FORMAT);\n $start->setMinute(0)->setSecond(0);\n $finish = new Zend_Date($this->_resource->getStartDbTime(), Varien_Date::DATETIME_INTERNAL_FORMAT);\n $finish->setMinute(0)->setSecond(0);\n\n $this->_jobDirection = true;\n } else if (isset($config['dateStart']) && isset($config['dateEnd'])) {\n // aggregation by period from user run or then extension installation is run\n if (empty($config['isRealCron'])) {\n $this->_isCron = false;\n }\n\n $finish = new Zend_Date($config['dateEnd'], Varien_Date::DATETIME_INTERNAL_FORMAT);\n $finish->setMinute(0)->setSecond(0);\n if ($finish->compare($maxTime) == 1) {\n $finish = clone $maxTime;\n }\n\n $start = new Zend_Date($config['dateStart'], Varien_Date::DATETIME_INTERNAL_FORMAT);\n $start->setMinute(0)->setSecond(0);\n } else {\n //normal cron aggregation\n if ($dbTime === null) {\n $start = clone $maxTime;\n $start->subMonth(1);\n } else {\n $start = new Zend_Date($dbTime, Varien_Date::DATETIME_INTERNAL_FORMAT);\n $start->setMinute(0)->setSecond(0);\n }\n $finish = clone $maxTime;\n }\n\n $this->_jobDateFrom = $start;\n $this->_jobDateTo = $finish;\n\n if (!$this->_isCron) {\n $this->_calculateIterationsOfAjaxCalls($config);\n $this->_calculatePercentForProgressBar();\n }\n }", "function getImeiDateTimesSQ($o_cassandra, $imei, $datetime1, $datetime2, $deviceTime, $orderAsc)\n{\n\n\t$TZ = '0530';\n\n\t$table = ($deviceTime)?'log1':'log2';\n\t$qtime = ($deviceTime)?'dtime':'stime';\n\n\t$dateList = getDateList($datetime1,$datetime2);\n\t$s_cql2 = \"SELECT * FROM $table\n\t\tWHERE\n\t\timei = '$imei'\n\t\tAND\n\t\tdate IN $dateList\n\t\tAND\n\t\t$qtime >= '$datetime1+$TZ'\n\t\tAND\n\t\t$qtime <= '$datetime2+$TZ'\n\t\t;\";\n\t$st_results = $o_cassandra->query($s_cql2);\n\n\t$dataType = TRUE;\t// TRUE for fulldata, otherwise lastdata\n\t$st_obj = logParser($st_results, $dataType, $orderAsc);\n\t\t\n\treturn $st_obj;\n}", "function station_current_schedule($scheds = array()) {\r\n\t$now = current_time(\"timestamp\");\r\n\t$current = array();\r\n\t\r\n\tforeach($scheds as $sched) {\r\n\t\r\n\t\tif($sched['day'] != date(\"l\", $now)) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\t\t\r\n\t\t$start = strtotime(date('Y-m-d', $now).$sched['start_hour'].':'.$sched['start_min'].' '.$sched['start_meridian']);\r\n\t\t\t\r\n\t\tif($sched['start_meridian'] == 'pm' && $sched['end_meridian'] == 'am') { //check for shows that run overnight into the next morning\r\n\t\t\t$end = strtotime(date('Y-m-d', ($now+86400)).$sched['end_hour'].':'.$sched['end_min'].' '.$sched['end_meridian']);\r\n\t\t}\r\n\t\telse {\r\n\t\t\t$end = strtotime(date('Y-m-d', $now).$sched['end_hour'].':'.$sched['end_min'].' '.$sched['end_meridian']);\r\n\t\t}\r\n\t\t\r\n\t\t//a show can't end before it begins... if it does, it ends the following day.\r\n\t\tif($end <= $start) {\r\n\t\t\t$end = $end + 86400;\r\n\t\t}\r\n\t\t\t\r\n\t\t//compare to the current timestamp\r\n\t\tif($start <= $now && $end >= $now) {\r\n\t\t\t$current = $sched;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn $current;\r\n}", "public function getCronPart(int $iPosition)\n {\n\t\t$iCount = count($this->aCronParts[$iPosition]);\n\t\tlist($iMin,$iMax) = self::CRONPARTRANGES[$iPosition];\n\t\t$iCountRange = $iMax - $iMin + 1;\n\n\t\tif ( $iPosition == self::DAY || $iPosition == self::WEEKDAY ) {\n\t\t\t$iCountOther = count($this->aCronParts[ ($iPosition == self::DAY ? self::WEEKDAY : self::DAY) ]);\n\t\t\tif ( $iCount == 0 && $iCountOther == 0) return null;\n\t\t\tif ( ($iCount == 0 && $iCountOther != 0) || ($iCountOther == 0 && $iCount == $iCountRange) ) return '*';\n\t\t} elseif ( $iCount == $iCountRange ) {\n\t\t\treturn '*';\n\t\t} elseif ($iCount == 0) {\n\t\t\treturn null;\n\t\t}\n\t\tif ($iCount == 1) return (string) $this->aCronParts[$iPosition][0];\n\t\tif ($iCount > 2 ) {\n\t\t\t// Try to detect a pattern\n\t\t\t$iCount = count($this->aCronParts[$iPosition]);\n\t\t\t$iDiff = null;\n\t\t\tfor ( $i=0; $i < ($iCount-1); $i++ ) {\n\t\t\t\t$iTemp = $this->aCronParts[$iPosition][$i+1] - $this->aCronParts[$iPosition][$i];\n\t\t\t\tif ($iDiff !== null && $iTemp != $iDiff) {\n\t\t\t\t\t$iDiff = null;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$iDiff = $iTemp;\n\t\t\t}\n\t\t\tif ( !is_null($iDiff) ) {\n\t\t\t\t$iStart = $this->aCronParts[$iPosition][0];\n\t\t\t\t$iEnd = $this->aCronParts[$iPosition][$iCount-1];\n\t\t\t\tif ($iStart == $iMin && ($iEnd + $iDiff) > $iMax) {\n\t\t\t\t\treturn '*'.( $iDiff == 1 ? '' : '/'.$iDiff );\n\t\t\t\t} else {\n\t\t\t\t\treturn $iStart.\"-\".$iEnd.( $iDiff == 1 ? '' : '/'.$iDiff );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn implode(',',$this->aCronParts[$iPosition]);\n\t}", "function draftScheduler_sequential_post_by_interval( $startDate, $intvHours, $intvMins ) {\r\n\t\t\t/*\r\n\t\t\t * $intvSecs, convert hours and minutes to seconds for the\r\n\t\t\t * sql query\r\n\t\t\t */\r\n\t\t\t$intvSecs = ( $intvHours * 60 * 60 ) + ( $intvMins * 60 );\r\n\r\n\t\t\tif ( isset( $_POST['draft_post_type'] ) ) {\r\n\t\t\t\t$post_type = esc_attr( $_POST['draft_post_type'] );\r\n\t\t\t} else {\r\n\t\t\t\t$post_type = 'post';\r\n\t\t\t}\r\n\r\n\t\t\t$draftList = $this->draftScheduler_Scheduler( $post_type, 'id' );\r\n\t\t\t$this->draftScheduler_add_undo( $draftList );\r\n\t\t\tif ( empty( $draftList ) ) {\r\n\t\t\t\treturn \"No drafts were found\";\r\n\t\t\t}\r\n\r\n\t\t\t$ds_postDate = strtotime( $startDate );\r\n\r\n\t\t\tforeach ( $draftList as $thisDraft ) {\r\n\r\n\t\t\t\t$this->update_post_details( $ds_postDate, $thisDraft->ID );\r\n\t\t\t\t$whole_post = get_post( $thisDraft->ID );\r\n\t\t\t\twp_transition_post_status( 'draft', 'future', $whole_post );\r\n\t\t\t\tcheck_and_publish_future_post( $thisDraft->ID );\r\n\r\n\t\t\t\t$ds_postDate += $intvSecs;\r\n\t\t\t}\r\n\r\n\t\t\treturn \"Drafts updated!\";\r\n\r\n\t\t}", "private function get_employee_schedule() {\n\n $date = new \\DateTime($this->date);\n $employeeSchedule = ScheduleModel::with(array('periods.weekdays'))->where('employee_id', $this->employeeId)->get();\n\n foreach ($employeeSchedule as $schedule) {\n\n $chairID = $schedule['chair_id'];\n\n foreach ($schedule['periods'] as $period) {\n\n $periodStart = new \\DateTime($period['start_date']);\n $periodEnd = new \\DateTime($period['end_date']);\n\n if ($date >= $periodStart && $date <= $periodEnd) {\n\n $day = $period['weekdays']->where('day', formatS($date));\n $dayScheduleColl[] = array('chairID' => $chairID, 'dayArray' => $day);\n\n }\n\n }\n\n }\n\n if (isset($dayScheduleColl)) {\n\n $this->make_day_schedule_array($dayScheduleColl);\n\n }\n }", "function _parse($cronStr, $min, $max) {\n $cronStr = trim($cronStr);\n // Is the value formally correct?\n if (!(preg_match('{^(\\*(/\\d+)?|\\d+(\\-\\d+(/\\d+)?)?|\\d+(,\\d+)*)$}', $cronStr))) {\n return FALSE;\n }\n $result = array();\n // Try to split on commas\n $times = explode(',', $cronStr);\n if (count($times) > 1) {\n foreach ($times as $time) {\n // Sort out illegal values\n if ($time < $min || $time > $max) {\n return FALSE;\n }\n }\n // If we're still here, we've got our result ready\n $result = $times;\n } else {\n // Try to split on a slash\n $timeAndInterval = explode('/', $cronStr);\n $time = $timeAndInterval[0];\n if (count($timeAndInterval) > 1) {\n $interval = $timeAndInterval[1];\n } else {\n $interval = 1;\n }\n // If time is an asterisk, use the full $min-$max range\n if ($time == '*') {\n $start = $min;\n $end = $max;\n } else {\n // Try to split time on a dash\n $startAndEnd = explode('-', $time);\n $start = $startAndEnd[0];\n if (count($startAndEnd) > 1) {\n $end = $startAndEnd[1];\n } else {\n $end = $start;\n }\n // Sort out illegal values\n if ($start > $end || $start < $min || $end > $max) {\n return FALSE;\n }\n }\n // Build the set of times\n for ($i = $start; $i <= $end; $i += $interval) {\n $result[] = \"$i\";\n }\n }\n return $result;\n }", "function job_manager_jobadder_sync_interval( $schedules ) {\n $interval = (int) get_option( 'jobadder_sync_interval', 15 );\n\n $schedules['jobadder_sync'] = array(\n 'interval' => $interval * 60,\n 'display' => sprintf( _n( 'Every minute', 'Every %s minutes', $interval, 'wp-job-manager-jobadder' ), $interval )\n );\n\n return $schedules;\n}", "function scheduledFlixData($u_id, $uf_id = false, $beginDate = false, $endDate = false)\n {\n $sql = 'SELECT fs_id AS FS_ID, fs_uf_id AS FS_UF_ID, fs_u_id AS FS_U_ID, UNIX_TIMESTAMP(fs_beginDate) AS FS_BEGINDATE, UNIX_TIMESTAMP(fs_endDate) as FS_ENDDATE, fs_initialPrivacy AS FS_INITIALPRIVACY, fs_privacy AS FS_PRIVACY '\n . 'FROM flix_scheduled';\n\n $u_id = $this->dbh->sql_safe($u_id);\n $sql .= ' WHERE fs_u_id = ' . $u_id;\n\n if( $uf_id !== false )\n {\n $uf_id = $this->dbh->sql_safe($uf_id);\n $sql .= ' AND fs_uf_id = ' . $uf_id;\n }\n\n if( $beginDate !== false )\n {\n $beginDate = date('Y-m-d H:i:s', $beginDate);\n $beginDate = $this->dbh->sql_safe($beginDate);\n $sql .= ' AND fs_beginDate = ' . $beginDate;\n }\n\n if( $endDate !== false )\n {\n $endDate = date('Y-m-d H:i:s', $endDate);\n $endDate = $this->dbh->sql_safe($endDate);\n $sql .= ' AND fs_endDate = ' . $endDate;\n }\n\n return $this->dbh->query_all($sql);\n }" ]
[ "0.5724007", "0.55037564", "0.5369679", "0.53612435", "0.53344524", "0.53325176", "0.53256685", "0.5304638", "0.5168151", "0.50373375", "0.5032224", "0.5014207", "0.49757558", "0.49687874", "0.4921212", "0.4893234", "0.4868678", "0.47801018", "0.47560024", "0.47451732", "0.47397822", "0.47062963", "0.46990737", "0.46960807", "0.46938276", "0.46901444", "0.4676412", "0.46748063", "0.46643576", "0.46505505" ]
0.5878869
0
This function takes an array of jobs build up by retrieveSchedulers and puts them into the schedulers_times table
function insertSchedules() { $GLOBALS['log']->info('----->Scheduler retrieving scheduled items and adding them to Job queue.'); $jobsArr = $this->retrieveSchedulers(); if(is_array($jobsArr['ids']) && !empty($jobsArr['ids']) && is_array($jobsArr['times']) && !empty($jobsArr['times'])) { foreach($jobsArr['ids'] as $k => $ids) { foreach($jobsArr['times'][$k] as $j => $time) { $guid = create_guid(); $q = "INSERT INTO schedulers_times (id, deleted, date_entered, date_modified, scheduler_id, execute_time, status) VALUES ( '".$guid."', 0, ".db_convert("'".TimeDate::getInstance()->nowDb()."'", 'datetime').", ".db_convert("'".TimeDate::getInstance()->nowDb()."'", 'datetime').", '".$jobsArr['ids'][$k]."', ".db_convert("'".$time."'", 'datetime').", 'ready' )"; $this->db->query($q); $GLOBALS['log']->info('Query: '.$q); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function retrieveSchedulers() {\n\t\t$GLOBALS['log']->info('Gathering Schedulers');\n\t\t$executeJobs = array();\n\t\t$query \t= \"SELECT id \" .\n\t\t\t\t\"FROM schedulers \" .\n\t\t\t\t\"WHERE deleted=0 \" .\n\t\t\t\t\"AND status = 'Active' \" .\n\t\t\t\t\"AND date_time_start < \".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\",'datetime').\" \" .\n\t\t\t\t\"AND (date_time_end > \".db_convert(\"'\".TimeDate::getInstance()->nowDb().\"'\",'datetime').\" OR date_time_end IS NULL)\";\n\t\t\t\t\n\t\t$result\t= $this->db->query($query);\n\t\t$rows=0;\n\t\t$executeTimes = array();\n\t\t$executeIds = array();\n\t\t$executeJobTimes = array();\n\t\twhile(($arr = $this->db->fetchByAssoc($result)) != null) {\n\t\t\t$focus = BeanFactory::getBean('Schedulers', $arr['id']);\n\t\t\t$executeTimes[$rows] = $this->deriveDBDateTimes($focus);\n\t\t\tif(count($executeTimes) > 0) {\n\t\t\t\tforeach($executeTimes as $k => $time) {\n\t\t\t\t$executeIds[$rows] = $focus->id;\n\t\t\t\t\t$executeJobTimes[$rows] = $time;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$rows++;\n\t\t}\n\t\t$executeJobs['ids'] = $executeIds;\n\t\t$executeJobs['times'] = $executeJobTimes;\n\t\treturn $executeJobs;\n\t}", "function checkPendingJobs() {\n\t\tglobal $sugar_config;\n\t\tglobal $timedate;\n\t\t\n\t\t$GLOBALS['log']->debug('');\n\t\t$GLOBALS['log']->debug('----->Scheduler checking for qualified jobs to run.');\n\t\tif(empty($this->db)) {\n\t\t\t$this->db = DBManagerFactory::getInstance();\n\t\t}\n\t\t\n\t\t$fireTimeMinus = $timedate->asDb($timedate->getNow()->get('-1 minute'));\n\t\t$fireTimePlus = $timedate->asDb($timedate->getNow()->get('+1 minute'));\n\n\t\t// collapse list of schedulers where \"catch_up\" is 0 and status is \"ready\" (not \"in progress, completed, etc.\");\n\t\t$q = 'UPDATE schedulers_times st\n\t\t\t\t\tSET st.status = \\'not run\\' \n\t\t\t\t\tWHERE st.execute_time < '.$this->db->convert($this->db->quoted($fireTimeMinus), 'datetime').'\n\t\t\t\t\tAND st.status = \\'ready\\' \n\t\t\t\t\tAND st.scheduler_id IN (SELECT s.id FROM schedulers s WHERE st.scheduler_id = s.id AND s.catch_up = 0)';\n\t\t$this->db->query($q);\n\t\t\n\t\t$q = 'SELECT DISTINCT st.id, st.scheduler_id, st.status, s.name, s.job FROM schedulers_times st\n\t\t LEFT JOIN schedulers s ON st.scheduler_id = s.id WHERE st.execute_time < '.$this->db->convert($this->db->quoted($fireTimeMinus), 'datetime').\n ' AND st.deleted=0 AND s.deleted=0 AND st.status=\\'ready\\' AND s.status=\\'Active\\' ORDER BY s.name';\n\t\t$r = $this->db->query($q);\n\t\t$count = 0;\n\n\t\twhile($a = $this->db->fetchByAssoc($r)) {\n\t\t\t\n\t\t\t$job = BeanFactory::newBean('SchedulersJobs');\n\t\t\t\n\t\t\t$paramJob = $a['scheduler_id'];\n\t\t\t$job->fire($sugar_config['site_url'].'/index.php?entryPoint=schedulers&type=job&job_id='.$paramJob.'&record='.$a['id']);\n\t\t\t$count++;\n\t\t}\n\n\n\t\tif($count < 1) {\n\t\t\t$GLOBALS['log']->debug('----->Scheduler has found 0 Jobs to fire');\n\t\t}\n\t}", "function getSchedulers() {\n\treturn array(\n\t\t\"wf2q+\" => array(\n\t\t\t\"name\" => \"Worst-case Weighted fair Queueing (default)\",\n\t\t\t\"parameter_format\" => \"type wf2q+\",\n\t\t\t\"description\" => \"Worst-case Weighted fair Queueing (WF2Q+) schedules flows with an associated weight. \".\n\t\t\t\t\t \"WF2Q+ is the default algorithm used by previous versions.\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"fifo\" => array(\n\t\t\t\"name\" => \"FIFO\",\n\t\t\t\"parameter_format\" => \"type fifo\",\n\t\t\t\"description\" => \"First-in-First-out is a fundamental queueing discipline which ensures packet sequence. \".\n\t\t\t\t\t \"Dynamic queues are not supported with the FIFO scheduler (all packets are stored in a single queue).\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"qfq\" => array(\n\t\t\t\"name\" => \"Quick Fair Queueing\",\n\t\t\t\"parameter_format\" => \"type qfq\",\n\t\t\t\"description\" => \"QFQ is a fast, low-complexity Approximated Fair Queueing scheduler.\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"rr\" => array(\n\t\t\t\"name\" => \"Round Robin\",\n\t\t\t\"parameter_format\" => \"type rr\",\n\t\t\t\"description\" => \"Round Robin (RR) schedules packets in a round-robin fashion.\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"prio\" => array(\n\t\t\t\"name\" => \"PRIO\",\n\t\t\t\"parameter_format\" => \"type prio\",\n\t\t\t\"description\" => \"PRIO schedules packets by their corresponding priority.\",\n\t\t\t\"parameters\" => array(),\n\t\t\t\"ecn\" => false\n\t\t),\n\t\t\"fq_codel\" => array(\n\t\t\t\"name\" => \"FQ_CODEL\",\n\t\t\t\"parameter_format\" => \"type fq_codel target %sms interval %sms quantum %s limit %s flows %s\",\n\t\t\t\"description\" => \"CoDel is a novel \\\"no knobs\\\", \\\"just works\\\", \\\"handles variable bandwidth and RTT\\\", and simple AQM algorithm.\"\n\t\t\t\t\t\t\t. \" As a scheduler, FQ_CODEL implements several flows (defined below), each having their own CoDel AQM.\",\n\t\t\t\"parameters\" => array(\n\t\t\t\t\"target\" => array(\"name\" => \"Target Delay (ms)\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.target\")) / 1000),\n\t\t\t\t\"interval\" => array(\"name\" => \"Interval (ms)\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.interval\")) / 1000),\n\t\t\t\t\"quantum\" => array(\"name\" => \"quantum\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.quantum\")),\n\t\t\t\t\"limit\" => array(\"name\" => \"limit\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.limit\")),\n\t\t\t\t\"flows\" => array(\"name\" => \"flows\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqcodel.flows\"))\n\t\t\t),\n\t\t\t\"ecn\" => true\n\t\t),\n\t\t\"fq_pie\" => array(\n\t\t\t\"name\" => \"FQ_PIE\",\n\t\t\t\"parameter_format\" => \"type fq_pie target %sms tupdate %sms alpha %s beta %s max_burst %s max_ecnth %s quantum %s limit %s flows %s\",\n\t\t\t\"description\" => \"Fair Queue Proportional Integral controller Enhanced AQM (FQ_PIE) is similar to FQ_CODEL but uses a slightly different algorithm.\",\n\t\t\t\"parameters\" => array(\n\t\t\t\t\"target\" => array(\"name\" => \"Target Delay (ms)\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.target\")) / 1000),\n\t\t\t\t\"tupdate\" => array(\"name\" => \"Interval (ms)\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.tupdate\")) / 1000),\n\t\t\t\t\"alpha\" => array(\"name\" => \"alpha\", \"type\" => \"number step=any\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.alpha\")) / 1000),\n\t\t\t\t\"beta\" => array(\"name\" => \"beta\", \"type\" => \"number step=any\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.beta\")) / 1000),\n\t\t\t\t\"max_burst\" => array(\"name\" => \"max_burst\", \"type\" => \"number\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.max_burst\")) / 1000),\n\t\t\t\t\"max_ecnth\" => array(\"name\" => \"max_ecnth\", \"type\" => \"number step=any\", \"default\" => intval(get_single_sysctl(\"net.inet.ip.dummynet.fqpie.max_ecnth\")) / 1000),\n\t\t\t\t\"quantum\" => array(\"name\" => \"quantum\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqpie.quantum\")),\n\t\t\t\t\"limit\" => array(\"name\" => \"limit\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqpie.limit\")),\n\t\t\t\t\"flows\" => array(\"name\" => \"flows\", \"type\" => \"number\", \"default\" => get_single_sysctl(\"net.inet.ip.dummynet.fqpie.flows\"))\n\t\t\t),\n\t\t\t\"ecn\" => true,\n\t\t\t\"pie_onoff\" => true,\n\t\t\t\"pie_capdrop\" => true,\n\t\t\t\"pie_qdelay\" => true,\n\t\t\t\"pie_pderand\" => true\n\t\t)\n\t);\n}", "public function getSchedulersJob()\n {\n return BeanFactory::newBean('SchedulersJobs');\n }", "public function get_wpcron_jobs(): array\n {\n $times = [];\n $cron_jobs = _get_cron_array();\n foreach ($cron_jobs as $key => $task) {\n if (isset($task[$this->slug])) {\n $times[] = ['datetime' => get_date_from_gmt(date('Y-m-d H:i:s', $key), 'F j, Y H:i:s'), 'timestamp' => $key, 'job' => $task];\n }\n }\n return $times;\n }", "protected static function get_schedules() {\n\t\t$schedules = wp_get_schedules();\n\t\tif ( ! empty( $schedules ) ) {\n\t\t\tuasort( $schedules, 'Cron_Schedule_Command::sort' );\n\t\t\t$schedules = array_map( 'Cron_Schedule_Command::format_schedule', $schedules, array_keys( $schedules ) );\n\t\t}\n\t\treturn $schedules;\n\t}", "public function run()\n {\n $schedules = [\n ['c_id' => '1', 'i_id' => 1, 'r_id' => 1, 'u_id' => 1, 's_id' => 28],\n ['c_id' => '1', 'i_id' => 2, 'r_id' => 2, 'u_id' => 2, 's_id' => 28],\n ['c_id' => '1', 'i_id' => 3, 'r_id' => 3, 'u_id' => 3, 's_id' => 28],\n ['c_id' => '2', 'i_id' => 4, 'r_id' => 4, 'u_id' => 1, 's_id' => 28],\n ['c_id' => '2', 'i_id' => 5, 'r_id' => 5, 'u_id' => 2, 's_id' => 28],\n ['c_id' => '2', 'i_id' => 1, 'r_id' => 6, 'u_id' => 3, 's_id' => 29],\n ['c_id' => '3', 'i_id' => 2, 'r_id' => 7, 'u_id' => 1, 's_id' => 29],\n ['c_id' => '3', 'i_id' => 3, 'r_id' => 8, 'u_id' => 2, 's_id' => 29],\n ['c_id' => '3', 'i_id' => 4, 'r_id' => 9, 'u_id' => 3, 's_id' => 29],\n ['c_id' => '4', 'i_id' => 5, 'r_id' => 10, 'u_id' => 1, 's_id' => 30],\n ['c_id' => '4', 'i_id' => 1, 'r_id' => 11, 'u_id' => 2, 's_id' => 30],\n ['c_id' => '4', 'i_id' => 2, 'r_id' => 12, 'u_id' => 3, 's_id' => 30],\n ['c_id' => '5', 'i_id' => 3, 'r_id' => 13, 'u_id' => 1, 's_id' => 31],\n ['c_id' => '5', 'i_id' => 4, 'r_id' => 14, 'u_id' => 2, 's_id' => 31],\n ['c_id' => '5', 'i_id' => 5, 'r_id' => 15, 'u_id' => 3, 's_id' => 31],\n ];\n foreach ($schedules as $key => $schedule) {\n DB::table('schedules')->insert($schedule);\n }\n }", "protected function addSchedulingTables() {\n\t\t$schema_sql_file = '../sql/scheduling_survey_schema.sql';\n\t\tif (!file_exists($schema_sql_file)) {\n\t\t\t$this->errors[] = \"Could not find survey schema file\\n\";\n\t\t\treturn;\n\t\t}\n\n\t\t$sql = file_get_contents($schema_sql_file);\n\t\t$this->mysql_api->query($sql);\n\t\techo \"Added scheduling tables\\n\";\n\t}", "private function generateCronJobs(){\n\t\t\n\t\t$jobs = \"\";\n\t\t\n\t\t$tmptime = $this->getUnixTime()-$this->hoursDelay*3600;\n\t\t//echo $tmptime . \",\" . time() . \"<hr>\";\n\t\t$timestart=0;\n\t\n\t\t//Classify the item depending on the time left.\n\t\t//Normalized time start.\n\t\tif(($tmptime-time())>43200) // >12h\n\t\t{\n\t\t\t$type = 1;\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=43200;\n\t\t\t$timestart-=43200;\n\t\t}\n\t\telseif(($tmptime-time())<=43200 && ($tmptime-time())>21600) // <=12h & >=6h\n\t\t{\n\t\t\t$type = 2;\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=21600;\n\t\t\t$timestart-=21600;\n\t\t}\n\t\telseif(($tmptime-time())<=21600 && ($tmptime-time())>7200) // <=6h & >=2h\n\t\t{\n\t\t\t$type = 3;\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=7200;\n\t\t\t$timestart-=7200;\n\t\t}\n\t\telseif(($tmptime-time())<=7200 && ($tmptime-time())>0) // <=2h\n\t\t{\n\t\t\t$type = 4;\t\n\t\t\twhile($tmptime-$timestart-time()>0) $timestart+=1800;\n\t\t\t$timestart-=1800;\n\t\t}\n\t\t\n\t\tswitch($type){\n\t\t\tcase 1: // >12h\n\t\t\t\twhile($timestart-43200-12*3600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=43200;\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase 2: // <=12h & >=6h. 1 cronjob every 6 hours\n\t\t\t\twhile($timestart-6*3600-6*3600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=6*3600;\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase 3: // <=6h & >=2h. 1 cronjob every 60min\n\t\t\t\twhile($timestart-3600-2*3600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=3600;\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase 4: // <=2h. 1 cronjob every 30min\n\t\t\t\twhile($timestart-1800-1800>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=1800;\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\twhile($timestart-600>=0){\n\t\t\t\t\t$jobs .= $this->generateCronJobLine($timestart).\"\\n\";\n\t\t\t\t\t$timestart-=600;\n\t\t\t\t}\n\t\t}\n\t\n\t\treturn $jobs;\n\t\n\t}", "public function testGetAllScheduledJobs()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "public function run()\n {\n DB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020000\",\n \t\t\"sbd\" => \"145\",\n \t\t'mlh_id' => \"INT3508He\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020000\",\n \t\t\"sbd\" => \"15\",\n \t\t'mlh_id' => \"INT3412 2\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020000\",\n \t\t\"sbd\" => \"14\",\n \t\t'mlh_id' => \"INT3406 1\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020000\",\n \t\t\"sbd\" => \"45\",\n \t\t'mlh_id' => \"INT3011 1\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020000\",\n \t\t\"sbd\" => \"5\",\n \t\t'mlh_id' => \"INE1050 2\",\n \t]);\n\n\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020001\",\n \t\t\"sbd\" => \"146\",\n \t\t'mlh_id' => \"INT3508He\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020001\",\n \t\t\"sbd\" => \"1\",\n \t\t'mlh_id' => \"INT3011 1\",\n \t]);\n\n\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020002\",\n \t\t\"sbd\" => \"11\",\n \t\t'mlh_id' => \"INT2044\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020002\",\n \t\t\"sbd\" => \"17\",\n \t\t'mlh_id' => \"INE1050 2\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020002\",\n \t\t\"sbd\" => \"19\",\n \t\t'mlh_id' => \"INT3306 1\",\n \t]);\n\n\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020003\",\n \t\t\"sbd\" => \"9\",\n \t\t'mlh_id' => \"INT3508He\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020003\",\n \t\t\"sbd\" => \"123\",\n \t\t'mlh_id' => \"INT2203 2\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020003\",\n \t\t\"sbd\" => \"149\",\n \t\t'mlh_id' => \"INT3011 1\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020003\",\n \t\t\"sbd\" => \"120\",\n \t\t'mlh_id' => \"INE1050 2\",\n \t]);\n\n\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020004\",\n \t\t\"sbd\" => \"197\",\n \t\t'mlh_id' => \"INT3508He\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020004\",\n \t\t\"sbd\" => \"239\",\n \t\t'mlh_id' => \"INT2203 2\",\n \t]);\n \tDB::table('test_schedules')->insert([\n \t\t'sv_id' => \"14020004\",\n \t\t\"sbd\" => \"125\",\n \t\t'mlh_id' => \"INE1050 2\",\n \t]);\n }", "public function run()\n {\n $array = array(\n \"Full Time\",\n \"Part Time\",\n \"InternShip\",\n );\n\n for ($i=0; $i < count($array); $i++) {\n JobType::create([\n 'name' => $array[$i]\n ]);\n }\n }", "public function run()\n {\n // first bus\n\n DB::table('schedules')->insert([\n 'bus_id' => 1,\n 'bus_stop_id' => 1,\n 'time' => '04:02'\n ]);\n DB::table('schedules')->insert([\n 'bus_id' => 1,\n 'bus_stop_id' => 2,\n 'time' => '05:02'\n ]);\n DB::table('schedules')->insert([\n 'bus_id' => 1,\n 'bus_stop_id' => 3,\n 'time' => '05:32'\n ]);\n\n // second bus\n\n DB::table('schedules')->insert([\n 'bus_id' => 2,\n 'bus_stop_id' => 1,\n 'time' => '07:02'\n ]);\n DB::table('schedules')->insert([\n 'bus_id' => 2,\n 'bus_stop_id' => 2,\n 'time' => '10:02'\n ]);\n DB::table('schedules')->insert([\n 'bus_id' => 2,\n 'bus_stop_id' => 3,\n 'time' => '15:32'\n ]);\n }", "public function run()\n {\n \t\n for ($i = 0; $i < 10; $i++) {\n DB::table('schedule')->insert([ //,\n 'week_opening' => date(\"h:i:s\",strtotime(\"8:00\")),#\"8:00\",\n \t'week_closing' => date(\"h:i:s\",strtotime(\"23:00\")),#\"23:00\",\n \t'saturday_opening' => date(\"h:i:s\",strtotime(\"8:00\")),#\"8:00\",\n \t'saturday_closing' => date(\"h:i:s\",strtotime(\"23:00\")),#\"23:00\",\n \t'sunday_opening' => date(\"h:i:s\",strtotime(\"8:00\")),#\"8:00\",\n \t'sunday_closing' => date(\"h:i:s\",strtotime(\"23:00\")),#\"23:00\"\n ]);\n\n\n }\n }", "private static function create_cron_jobs() {\n wp_clear_scheduled_hook( 'dashpayments_check_unpaid_orders' );\n wp_schedule_event( time(), 'every_minute', 'dashpayments_check_unpaid_orders' );\n }", "public function run()\n {\n \n\n \\DB::table('schedules')->delete();\n \n \\DB::table('schedules')->insert(array (\n 0 => \n array (\n 'id' => 2,\n 'user_id' => 2,\n 'admin_id' => 6,\n 'contract_id' => 6,\n 'note' => NULL,\n 'start' => '2019-06-10 08:00:00',\n 'end' => '2019-06-10 10:00:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-09 21:51:34',\n 'updated_at' => '2019-06-09 21:51:34',\n ),\n 1 => \n array (\n 'id' => 3,\n 'user_id' => 2,\n 'admin_id' => 6,\n 'contract_id' => 6,\n 'note' => NULL,\n 'start' => '2019-05-28 08:00:00',\n 'end' => '2019-05-28 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-14 22:50:46',\n 'updated_at' => '2019-06-14 22:50:46',\n ),\n 2 => \n array (\n 'id' => 6,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-06-15 08:00:00',\n 'end' => '2019-06-15 10:00:00',\n 'user_confirm' => 1,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 21:46:16',\n 'updated_at' => '2019-06-16 03:47:08',\n ),\n 3 => \n array (\n 'id' => 9,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-06-22 08:00:00',\n 'end' => '2019-06-22 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:02:18',\n 'updated_at' => '2019-06-15 22:02:18',\n ),\n 4 => \n array (\n 'id' => 11,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-06-24 08:00:00',\n 'end' => '2019-06-24 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:02:32',\n 'updated_at' => '2019-06-15 22:02:32',\n ),\n 5 => \n array (\n 'id' => 12,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-06-25 08:00:00',\n 'end' => '2019-06-25 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:02:49',\n 'updated_at' => '2019-06-15 22:02:49',\n ),\n 6 => \n array (\n 'id' => 13,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-06-26 08:00:00',\n 'end' => '2019-06-26 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:02:56',\n 'updated_at' => '2019-06-15 22:02:56',\n ),\n 7 => \n array (\n 'id' => 14,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-06-27 08:00:00',\n 'end' => '2019-06-27 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:03:02',\n 'updated_at' => '2019-06-15 22:03:02',\n ),\n 8 => \n array (\n 'id' => 15,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-06-28 08:00:00',\n 'end' => '2019-06-28 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:03:15',\n 'updated_at' => '2019-06-15 22:03:15',\n ),\n 9 => \n array (\n 'id' => 16,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-06-29 08:00:00',\n 'end' => '2019-06-29 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:03:22',\n 'updated_at' => '2019-06-15 22:03:22',\n ),\n 10 => \n array (\n 'id' => 17,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-06-30 08:00:00',\n 'end' => '2019-06-30 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:03:29',\n 'updated_at' => '2019-06-15 22:03:29',\n ),\n 11 => \n array (\n 'id' => 18,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-07-01 08:00:00',\n 'end' => '2019-07-01 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:03:36',\n 'updated_at' => '2019-06-15 22:03:36',\n ),\n 12 => \n array (\n 'id' => 19,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-07-02 08:00:00',\n 'end' => '2019-07-02 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:03:59',\n 'updated_at' => '2019-06-15 22:03:59',\n ),\n 13 => \n array (\n 'id' => 20,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-07-03 08:00:00',\n 'end' => '2019-07-03 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-15 22:04:13',\n 'updated_at' => '2019-06-15 22:04:13',\n ),\n 14 => \n array (\n 'id' => 22,\n 'user_id' => 3,\n 'admin_id' => 6,\n 'contract_id' => 7,\n 'note' => NULL,\n 'start' => '2019-07-05 08:00:00',\n 'end' => '2019-07-05 09:30:00',\n 'user_confirm' => 0,\n 'admin_confirm' => 0,\n 'deleted' => 0,\n 'created_at' => '2019-06-16 03:24:44',\n 'updated_at' => '2019-06-16 03:24:44',\n ),\n ));\n \n \n }", "public function jobs($args, $assoc_args) {\n $site = SiteFactory::instance($assoc_args['site']);\n $jobs = $site->jobs();\n $data = array();\n foreach ($jobs as $job) {\n $data[] = array(\n 'slot' => $job->slot,\n 'name' => $job->human_name,\n 'env' => @$job->environment,\n 'status' => $job->status,\n 'updated' => $job->changed\n );\n }\n $this->handleDisplay($data,$args);\n }", "public function getScheduleTimes();", "public function createSchedule($args) {\n\t\t// cancel all non-existent carts\n\t\t$this->cancelNonExistentCarts(['pending', 'abondoned']);\n\n\t\t$results = $this->getAbondonedCartRecords($args['counter'], $args['duration']);\n\t\tif(!is_null($results) && count($results) > 0){\n\t\t\t$items = [];\n\t\t\t$records = [];\n\t\t\tforeach ($results as $result) {\n\t\t\t\t$cart = maybe_unserialize($result->cart);\n\t\t\t\tif(!empty($cart) && count($cart) > 0){\n\t\t\t\t\t$records[] = $this->prepareQueueItem($result->key); \n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->insertQueueRecords($records);\n\t\t}\n\t}", "function hys_crontimes( $schedules ) {\n\t$schedules['weekly'] = array(\n\t\t'interval' => 604800,\n\t\t'display' => __('Weekly')\n\t);\n\t$schedules['monthly'] = array(\n\t\t'interval' => 2629743,\n\t\t'display' => __('Monthly')\n\t);\n\t$schedules['quarterly'] = array(\n\t\t'interval' => 10518972,\n\t\t'display' => __('Quarterly')\n\t);\n\t$schedules['biyearly'] = array(\n\t\t'interval' => 15778458,\n\t\t'display' => __('BiYearly')\n\t);\n\t$schedules['yearly'] = array(\n\t\t'interval' => 31556926,\n\t\t'display' => __('Yearly')\n\t);\n\treturn $schedules;\n}", "public static function setScheduleJob()\n {\n return [\n [\n 'class' => 'backend\\modules\\helpdesk\\job\\StatsConversation',\n 'interval' => TimeUtil::SECONDS_OF_DAY,\n 'executeAt' => 'Y-m-d 00:00:01'\n ]\n ];\n }", "function cron_schedules( $schedules ) {\n\t\t// Add the upgrade interval to the existing schedules.\n\t\t$schedules[ $this->cron_schedule_key ] = array(\n\t\t\t'interval' => $this->cron_interval_in_minutes * 60,\n\t\t\t'display' => sprintf( __( 'Every %d Minutes', 'amazon-s3-and-cloudfront' ), $this->cron_interval_in_minutes ),\n\t\t);\n\n\t\treturn $schedules;\n\t}", "public function job_send_link_for_scheduling(){\n $qualified = $this->Admin_model->get_turn_over_qualifieds();\n\n foreach($qualified as $data){\n $customer_number = $data->customer_number;\n $project = $data->project;\n $runitid = $data->runitid;\n $type = $data->type;\n $accepted_qcd = $data->accepted_qcd;\n $accepted_handover = $data->accepted_handover;\n $qualified_turnover = $data->qualified_turnover_date;\n \n if (!empty($accepted_qcd)){\n if(!empty($accepted_handover)){\n $get_customers = $this->Admin_model->get_buyers_by_customer_number($customer_number);\n //Check the parking if with unit\n if ($type === 'PK'){\n foreach($get_customers as $get_customer){\n //get the tin of tag as parking\n $tin_number = $get_customer->tin;\n //Get customer number by tin\n $get_customer_by_tins = $this->Admin_model->get_tin_by_customer_number($tin_number);\n //Store the return customer number to array\n $return_customer_numbers = array();\n foreach ($get_customer_by_tins as $get_customer_by_tin) {\n $return_customer_numbers[] = $get_customer_by_tin->customer_number;\n }\n //Loop to each customer number on the array to get the bundled unit\n foreach($return_customer_numbers as $return_customer_number){\n $get_buyers_transacs = $this->Admin_model->get_buyers_trans($return_customer_number);\n foreach($get_buyers_transacs as $get_buyers_transac){\n $unit_type = $get_buyers_transac->type;\n $qualified_un = $get_buyers_transac->qualified_turnover_date;\n if($unit_type == \"UN\"){\n //If the qualified turn over of parking is greater than the qualified turnover of unit \n //Not valid of scheduling\n if($qualified_turnover < $qualified_un){\n $search_for_tickets = $this->Admin_model->get_ticket_number_by_customer_number($customer_number);\n foreach($search_for_tickets as $data){\n $ticket_id = $data->id;\n $email = $data->email_address;\n $encrypt_ticket_id = $this->dec_enc($ticket_id , 'encrypt');\n \n $link = base_url().\"default_user/schedule/\". $encrypt_ticket_id;\n //echo \"<script>alert('\". $ticket_id .\"');</script>\";\n $this->send_email($email, \"WESERVE - For Scheduling link\" , $link);\n \n //Save the link to the database\n $datas = array(\n 'ticket_number' => $data->ticket_number ,\n 'temp_link' => $link , \n 'status' => '0' , \n 'date_created' => $date_now = date(\"Y/m/d H:i:s\")\n );\n $this->Admin_model->save_link_to_db($datas);\n }\n }else{\n //Do nothing\n }\n }\n }\n }\n }\n }else{\n //If the unit is not parking sched the other type\n //parking is important kasi ano need siya eh wag ka ano.\n $search_for_tickets = $this->Admin_model->get_ticket_number_by_customer_number($customer_number);\n foreach($search_for_tickets as $data){\n $ticket_id = $data->id;\n $email = $data->email_address;\n $encrypt_ticket_id = $this->dec_enc($ticket_id , 'encrypt');\n\n $link = base_url().\"default_user/schedule/\". $encrypt_ticket_id;\n //echo \"<script>alert('\". $ticket_id .\"');</script>\";\n $this->send_email($email, \"WESERVE - For Scheduling link\" , $link);\n\n //Save the link to the database\n $data = array(\n 'ticket_number' => $data->ticket_number ,\n 'temp_link' => $link , \n 'status' => '0' , \n 'date_created' => $date_now = date(\"Y/m/d H:i:s\")\n );\n $this->Admin_model->save_link_to_db($data);\n }\n }\n }else{\n //Do Nothing\n }\n }else{\n //Do Nothing\n }\n }\n \n }", "function dropSchedules($truncate=false) {\n\t\tglobal $sugar_config;\n\t\t\n\t\tif(empty($this->db)) {\n\t\t\t$this->db = DBManagerFactory::getInstance();\t\n\t\t}\n\t\t\n\t\tif($truncate) {\n $query = $this->db->truncateTableSQL('schedulers_times');\n\t\t\t$this->db->query($query);\n\t\t\t$GLOBALS['log']->debug('----->Scheduler TRUNCATED ALL Jobs: '.$query);\n\t\t} else {\n\t\t\t$query = 'UPDATE schedulers_times SET deleted = 1';\n\t\t\t$this->db->query($query);\n\t\t\t$GLOBALS['log']->debug('----->Scheduler soft deleting all Jobs: '.$query);\n\t\t}\n\t\t//TODO make sure this will fail gracefully\n\t}", "function scheduledTasks()\n{\n\t$db = database();\n\n\t$known_tasks = array();\n\t$db->fetchQuery('\n\t\tSELECT \n\t\t\tid_task, next_time, time_offset, time_regularity, time_unit, disabled, task\n\t\tFROM {db_prefix}scheduled_tasks',\n\t\tarray()\n\t)->fetch_callback(\n\t\tfunction ($row) use (&$known_tasks) {\n\t\t\tglobal $txt;\n\n\t\t\t// Find the next for regularity - don't offset as it's always server time!\n\t\t\t$offset = sprintf($txt['scheduled_task_reg_starting'], date('H:i', $row['time_offset']));\n\t\t\t$repeating = sprintf($txt['scheduled_task_reg_repeating'], $row['time_regularity'], $txt['scheduled_task_reg_unit_' . $row['time_unit']]);\n\n\t\t\t$known_tasks[] = array(\n\t\t\t\t'id' => $row['id_task'],\n\t\t\t\t'function' => $row['task'],\n\t\t\t\t'name' => $txt['scheduled_task_' . $row['task']] ?? $row['task'],\n\t\t\t\t'desc' => $txt['scheduled_task_desc_' . $row['task']] ?? '',\n\t\t\t\t'next_time' => $row['disabled'] ? $txt['scheduled_tasks_na'] : standardTime(($row['next_time'] == 0 ? time() : $row['next_time']), true, 'server'),\n\t\t\t\t'disabled' => $row['disabled'],\n\t\t\t\t'checked_state' => $row['disabled'] ? '' : 'checked=\"checked\"',\n\t\t\t\t'regularity' => $offset . ', ' . $repeating,\n\t\t\t);\n\t\t}\n\t);\n\n\treturn $known_tasks;\n}", "public function run()\n {\n //\n DB::table('job_orders')->insert([\n 'inspection_id' => '1',\n 'jobStart' => '2018-06-29', \n 'jobStart_time' => '09:00:00',\n 'start' => '2018-06-29', \n 'start_time' => '11:00:00',\n 'end' => '2018-07-01', \n 'end_time' => '16:00:00',\n 'progressCount' => '100.00',\n 'isStatus' => 1,\n 'isStartEnabled' => 1,\n 'isStopEnabled' => 1,\n 'created_at' => '2018-10-18 10:30:35',\n ]);\n\n DB::table('job_orders')->insert([\n 'inspection_id' => '2',\n 'jobStart' => '2018-10-09',\n 'jobStart_time' => '8:00:00',\n 'isStartEnabled' => 1,\n 'isStopEnabled' => 1,\n 'start' => '2018-10-9', \n 'start_time' => '10:00:00',\n 'end' => '2018-10-12', \n 'end_time' => '17:00:00',\n 'progressCount' => '100.00',\n 'isStatus' => 1,\n 'created_at' => '2018-09-17 10:05:35',\n 'updated_at' => '2018-10-10 17:00:20',\n \n ]);\n DB::table('job_orders')->insert([\n 'inspection_id' => '4',\n 'jobStart' => '2018-10-15',\n 'jobStart_time' => '09:00:00',\n 'start' => '2018-10-15', \n 'start_time' => '09:00:00',\n 'end' => '2018-10-17', \n 'end_time' => '14:00:00',\n 'progressCount' => '100.00',\n 'isStatus' => 1,\n 'created_at' => '2018-10-15 9:00:00',\n 'updated_at' => '2018-10-17 14:00:00',\n \n ]);\n\n DB::table('job_orders')->insert([\n 'inspection_id' => '5',\n 'jobStart' => '2018-10-19',\n 'jobStart_time' => '11:00:00',\n 'start' => '2018-10-19', \n 'start_time' => '11:00:00',\n 'end' => '2018-10-20', \n 'end_time' => '14:00:00',\n 'progressCount' => '100.00',\n 'isStatus' => 1,\n 'created_at' => '2018-10-19 11:00:00',\n 'updated_at' => '2018-10-20 14:01:00',\n \n ]);\n }", "public function queueScheduledUpdates() {\n if( !empty($this->scheduledUpdates) ) {\n Queue::push(Updater::class, array_map('serialize', $this->scheduledUpdates));\n }\n }", "public function getJobs() {\n $this->markTestIncomplete(\n 'This test has not been implemented yet.'\n );\n }", "function cron_add_schedules( $schedules ) {\n\t$schedules['30minutes'] = array(\n\t\t\t'interval' => 30*60,\n\t\t\t'display' => __( '30 Minutos' )\n\t);\n\t$schedules['15minutes'] = array(\n\t\t\t'interval' => 15*60,\n\t\t\t'display' => __( '15 Minutos' )\n\t);\n\treturn $schedules;\n\t$schedules['2hours'] = array(\n\t\t\t'interval' => 120*60,\n\t\t\t'display' => __( '2 Horas' )\n\t);\n}", "public function getSchedules() {\n\n\t\t$schedules = new HMBKP_Schedules();\n\t\t$array = array();\n\n\t\tforeach ( $schedules->get_schedules() as $schedule )\n\t\t\t$array[] = array( 'id' => $schedule->get_id(), 'next_run_date' => $schedule->get_next_occurrence() );\n\n\t\treturn $array;\n\t}" ]
[ "0.7631926", "0.62532216", "0.5945125", "0.58877593", "0.585419", "0.55087024", "0.5496318", "0.5493946", "0.54375845", "0.54346466", "0.5400785", "0.53574336", "0.5318962", "0.5313095", "0.5282912", "0.52822644", "0.5273661", "0.5253253", "0.52434033", "0.52378416", "0.52145565", "0.52067995", "0.5205095", "0.5183758", "0.51745474", "0.5167951", "0.51628625", "0.5160965", "0.51589084", "0.51152503" ]
0.78042996
0
This function drops all rows in the schedulers_times table.
function dropSchedules($truncate=false) { global $sugar_config; if(empty($this->db)) { $this->db = DBManagerFactory::getInstance(); } if($truncate) { $query = $this->db->truncateTableSQL('schedulers_times'); $this->db->query($query); $GLOBALS['log']->debug('----->Scheduler TRUNCATED ALL Jobs: '.$query); } else { $query = 'UPDATE schedulers_times SET deleted = 1'; $this->db->query($query); $GLOBALS['log']->debug('----->Scheduler soft deleting all Jobs: '.$query); } //TODO make sure this will fail gracefully }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteSchedules()\n {\n //@codingStandardsIgnoreStart\n $query = \"SELECT id FROM workflow_schedules WHERE workflow_schedules.workflow_id = \" . $this->db->quoted($this->id);\n $result = $this->db->query($query, true, \"Error getting workflow_schedules for workflow_id: \" . $this->db->quote($this->id));\n //@codingStandardsIgnoreEnd\n\n // Remove each workflow schedule by id\n $removeExpired = array();\n $workflowSchedule = new WorkFlowSchedule();\n while ($row = $this->db->fetchByAssoc($result)) {\n $removeExpired[] = $row['id'];\n }\n $workflowSchedule->remove_expired($removeExpired);\n }", "public function cleanupTimerCallback() {\n $now = time();\n $keys = [];\n foreach ($this->_timestamps as $key => $timestamp) {\n if ($timestamp < $now) {\n $keys[] = $key;\n }\n }\n if (!empty($keys)) {\n $this->deleteMultiple($keys);\n }\n }", "static function clear_scheduler(){\n\t\twp_clear_scheduled_hook(self::hook);\n\t}", "private function delete_all_records() {\n\t\tglobal $wpdb;\n\n\t\t$wpdb->query( \"DROP TABLE {$wpdb->stream}\" );\n\t\t$wpdb->query( \"DROP TABLE {$wpdb->streammeta}\" );\n\t}", "public function purgeTable() {\n\t\tglobal $dbc;\n\t\t$query = 'truncate table ek_wysylka';\n\t\t$dbc->execute($query);\n\t}", "function unschedule() {\n\t\t$this->as3cf->clear_scheduled_event( $this->cron_hook );\n\t}", "public function truncate_all() {\n global $wpdb;\n\n // truncate the tables\n $tables = [\n 'erp_hr_leave_policies',\n 'erp_hr_leave_entitlements',\n 'erp_hr_leave_requests',\n 'erp_hr_leaves',\n 'erp_user_leaves',\n 'erp_hr_holiday'\n ];\n\n foreach ($tables as $table) {\n $wpdb->query('TRUNCATE TABLE ' . $wpdb->prefix . $table);\n }\n }", "public function truncateAll(): void\n {\n $tables = [\n Newsletter::TABLE_NAME,\n Link::TABLE_NAME,\n Log::TABLE_NAME,\n Queue::TABLE_NAME\n ];\n foreach ($tables as $table) {\n DatabaseUtility::getConnectionForTable($table)->truncate($table);\n }\n }", "public function cleanup()\n {\n $iTimeFrame = oxRegistry::getConfig()->getRequestParameter(\"timeframe\");\n $dNow = time();\n $iTimestamp = mktime(\n date(\"H\", $dNow),\n date(\"i\", $dNow),\n date(\"s\", $dNow),\n date(\"m\", $dNow),\n date(\"d\", $dNow) - $iTimeFrame,\n date(\"Y\", $dNow)\n );\n $sDeleteFrom = date(\"Y-m-d H:i:s\", $iTimestamp);\n\n $oDb = oxDb::getDb();\n $oDb->Execute(\"delete from oxlogs where oxtime < \" . $oDb->quote($sDeleteFrom));\n }", "private function removeExpiredMessages(): void\n {\n if (null === $this->removeExpiredMessagesLastExecutedAt) {\n $this->removeExpiredMessagesLastExecutedAt = \\microtime(true);\n } elseif ((\\microtime(true) - $this->removeExpiredMessagesLastExecutedAt) < 1) {\n return;\n }\n\n $this->connection->createQueryBuilder()\n ->delete($this->tableName)\n ->andWhere('(time_to_live IS NOT NULL) AND (time_to_live < :now)')\n ->andWhere('delivery_id IS NULL')\n ->setParameter(':now', (new \\DateTimeImmutable())->getTimestamp(), Type::INTEGER)\n ->execute()\n ;\n\n $this->removeExpiredMessagesLastExecutedAt = \\microtime(true);\n }", "public function resetQueue()\n {\n $shopQueueLogs = ShopQueueLog::all();\n foreach ($shopQueueLogs as $shopQueueLog) {\n if ($shopQueueLog->expires_at > 0) {\n $carbon = Carbon::parse($shopQueueLog->created_at);\n // if expired, remove the entry from the shop_queue_logs table\n if ($carbon->diffInMinutes(Carbon::now()) >= $shopQueueLog->expires_at) {\n $shopQueueLog->delete();\n }\n }\n }\n }", "function remove_crons() {\n \twp_clear_scheduled_hook('wpxlstopdfw_cleanup');\n }", "public function process_slp_clear_schedule_messages() {\n\t $messages = SLP_Message_Manager::get_instance( array( 'slug' => 'schedule' ) );\n\t $messages->clear_messages();\n\t die( 'ok' );\n }", "public function clear_all() {\n\n\t\tglobal $wpdb;\n\n\t\t//phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching\n\t\t//phpcs:disable WordPress.DB.PreparedSQL.NotPrepared\n\t\t$wpdb->query( 'TRUNCATE TABLE ' . self::get_table_name() );\n\t\t//phpcs:enable WordPress.DB.DirectDatabaseQuery.NoCaching\n\t\t//phpcs:enable WordPress.DB.PreparedSQL.NotPrepared\n\t}", "public function deleteAll()\n {\n $query = 'TRUNCATE TABLE `'. $this->getTableName() .'`';\n $this->db->sql_query($query);\n\n $query = 'TRUNCATE TABLE `' . $GLOBALS['tableprefix'] . 'watched' . '`';\n $this->db->sql_query($query);\n }", "function remove_all() {\n\t\t$query = $this->db->where('teacher_id', $this->teacher_id)\n\t\t\t\t\t\t->delete($this->my_conf->timetable_tbl);\n\t\treturn $query;\n\t}", "private function delete_all_cron_events() {\n\t\twp_clear_scheduled_hook( 'wp_stream_auto_purge' );\n\t}", "public function aaiClearVisitorsTable() {\n $table_cleared_at = variable_get('aai_visitor_table_trimmed_at', 0);\n $now = time();\n\n if (!$table_cleared_at) {\n variable_set('aai_visitor_table_trimmed_at', $now);\n $table_cleared_at = $now;\n }\n\n // get seconds in 4 hours\n $four_hrs_hence_cleared = (60 * 60 * 4) + $table_cleared_at;\n $buffer_seconds = (60 * 5) + $four_hrs_hence_cleared;\n\n // check if 4 hours passed since last table truncate operation\n if ($now >= $four_hrs_hence_cleared && $now <= $buffer_seconds) {\n // truncate the table\n $db->dbTruncateQuery('aai_visitors');\n\n // set variable\n variable_set('aai_visitor_table_trimmed_at', $now);\n }\n }", "protected function truncateTables()\n {\n $this->progress->setMessage(\"Truncating tables\");\n\n try {\n $connection = $this->doctrine->getConnection();\n $connection->beginTransaction();\n $connection->query(\"SET FOREIGN_KEY_CHECKS = 0\");\n\n $connection->query(\"TRUNCATE user\");\n $connection->query(\"TRUNCATE location\");\n $connection->query(\"TRUNCATE event\");\n $connection->query(\"TRUNCATE event_subscription\");\n\n $connection->query(\"SET FOREIGN_KEY_CHECKS = 1\");\n $connection->commit();\n }\n catch (\\Exception $e) {\n $connection->rollBack();\n throw $e;\n }\n }", "public function cleanSessionTable() {\n\t\t$sqlQuery = sprintf(\"DELETE FROM session WHERE expiration <= NOW()\");\n\t\t$this->getDb()->query($sqlQuery);\n\t}", "private function cleanTables()\n\t{\n\t\tforeach ($this->tables as $tableName)\n\t\t{\n\t\t\tDB::table($tableName)->truncate();\n\t\t}\n\t\t//DB::statement('SET FOREIGN_KEY_CHECKS = 1;');\n\t}", "function purgeUnsavedChangeSets() {\t\n\n\t$sets_to_purge = sqlSelect(\"*\", CHANGE_SETS_TABLE, \"scheduler_run_id = \" . scheduler_run()['id'] . \" and when_saved is null\", \"\", (0), \"purgeUnsavedChangeSets()\");\n\tforeach ($sets_to_purge as $i=>$set_to_purge) {\n\t\tsqlDelete(CHANGES_TABLE, \"change_set_id = {$set_to_purge['id']}\", (0), \"purgeUnsavedChangeSets(): deleting changes in change set\");\n\t\tsqlDelete(CHANGE_SETS_TABLE, \"id = {$set_to_purge['id']}\", (0), \"purgeUnsavedChangeSets(): deleting change set\");\n\t}\n}", "public function deleteOldBookingsFromDb(): void\n {\n /** @var Config $configAdapter */\n $configAdapter = $this->framework->getAdapter(Config::class);\n\n /** @var Date $dateAdapter */\n $dateAdapter = $this->framework->getAdapter(Date::class);\n\n /** @var Database $databaseAdapter */\n $databaseAdapter = $this->framework->getAdapter(Database::class);\n\n /** @var System $systemAdapter */\n $systemAdapter = $this->framework->getAdapter(System::class);\n\n if (($intWeeks = (int) $configAdapter->get('rbb_intBackWeeks')) < 0) {\n $intWeeks = abs($intWeeks);\n $dateMonThisWeek = $dateAdapter->parse('d-m-Y', strtotime('monday this week'));\n\n if (false !== ($tstampLimit = strtotime($dateMonThisWeek.' -'.$intWeeks.' weeks'))) {\n $objStmt = $databaseAdapter->getInstance()->prepare('DELETE FROM tl_resource_booking WHERE endTime<?')->execute($tstampLimit);\n\n if (($intRows = $objStmt->affectedRows) > 0) {\n $systemAdapter->log(sprintf('CRON: tl_resource_booking has been cleaned from %s old entries.', $intRows), __METHOD__, TL_CRON);\n }\n }\n }\n }", "public function clear_scheduled_task() {\n\t\twp_clear_scheduled_hook( self::$scheduled_key );\n\t}", "public function delete_all() {\n $this->db->prepare(\"TRUNCATE cayl_cache\")->execute();\n $this->db->prepare(\"TRUNCATE cayl_check\")->execute();\n }", "function cleanupUpdateTable(){\n\tif(isset($_SESSION['updateTableCleanup']) == false || $_SESSION['updateTableCleanup'] < time()){\n\t\t$_SESSION['updateTableCleanup'] = intval(time()) + 300;\n\t\t$cleanupQuery = \"DELETE FROM updates WHERE updateTime < DATE_SUB(CURRENT_TIMESTAMP,INTERVAL 300 SECOND) AND updateID NOT IN ( SELECT updatequeue.updateID FROM updatequeue );\";\n\t\trunQuery($cleanupQuery);\n\t}\n}", "function clearOnTime()\n {\n require_once 'config.php';\n require_once 'session.php';\n require_once 'connect_db.php';\n\n $conn = connectDb();\n $timenow = time();\n $timereq = $timenow - TIME_LIMIT;\n $sql_a = \"delete from x2_session where sessionlogintime<=$timereq\";\n $conn->exec($sql_a);\n $sql_b = \"delete from x2_user where userregtime<=$timereq and userstate=0\";\n $conn->exec($sql_b);\n $conn=null;\n }", "function remove_outdated_reservations() {\n\t\tglobal $wpdb;\n\n\t\t$wpdb->query( $wpdb->prepare( \"DELETE FROM {$this->reservations_db_table_name} WHERE expires <= %d AND processed = 0\", current_time( 'timestamp', 1 ) ) );\n\t}", "public function cleanup() {\n $this->basedir = $this->directoryList->getRoot();\n $this->checkCronFolderExistence();\n $this->initialize();\n /* gets a list of all schedule ids in the cron table */\n $scheduleids = $this->resource->cleanSchedule($this->history);\n /* gets a list of all cron schedule output files */\n $fileids = $this->getScheduleOutputIds();\n /* get a list of all schedule output files that are no longer in the cron schedule file */\n $diff = array_diff($fileids,$scheduleids);\n foreach ($diff as $id) {\n /* remove the old cron schedule output files */\n $this->unsetPid('schedule.'.$id);\n }\n }", "protected function truncateAllTables()\n {\n $tableNames = self::getAllDatabaseTables(self::$databaseName);\n\n foreach ($tableNames as $record) {\n $tableName = $record['TABLE_NAME'];\n\n // Truncate the table.\n self::$pdo->exec(\"TRUNCATE TABLE {$tableName};\");\n }\n }" ]
[ "0.61817247", "0.59382224", "0.5910769", "0.58160496", "0.57179844", "0.57151306", "0.56878096", "0.5674318", "0.56458765", "0.5601804", "0.5592328", "0.5591388", "0.5574428", "0.5573555", "0.5565195", "0.5556823", "0.5525727", "0.549469", "0.54862577", "0.54801905", "0.5474465", "0.54628843", "0.54602265", "0.54513925", "0.54411834", "0.5431175", "0.5417722", "0.5375699", "0.5372217", "0.5366279" ]
0.7358737
0
/ Takes two arguments, slot and match. Returns an array with slot and match data if ratings exist for the slot, otherwise returns null.
public function exportSlot($slot, $match, $asNominal = false) { $row = array(); $accountID = $slot->get('account_id'); $player = $this->playerRepository->getByAccountID($accountID); if(empty($player)) { return null; } $playerID = $player->getID(); $matchID = $match->get('match_id'); $ratings = null; $ratings = $this->playerRatingRepository->getByPlayerIDAndMatchID($playerID, $matchID); $averageRating = "?"; $submittedRatingsCount = 0; $ratingTotal = 0; if(is_array($ratings) && count($ratings) > 0) { if(isset($player)) { $row[] = "'" . $player->getName() . "'"; } else { $row[] = "?"; } // There are 4 reserved places for the ratings (one for each other player on the team) so we need to fill all of them with either the rating or an empty string (if unrated) for($i = 0; $i < 4; $i++) { if((isset($ratings[$i]) || array_key_exists($i, $ratings)) && $ratings[$i]->getRating() != 0) { if($asNominal) { $row[] = $this->convertToNominal($ratings[$i]->getRating(), "RATING"); } else { $row[] = $ratings[$i]->getRating(); } $ratingTotal += $ratings[$i]->getRating(); $submittedRatingsCount++; } else { $row[] = "?"; } } if($submittedRatingsCount > 0) { $averageRating = $ratingTotal / $submittedRatingsCount; } } // If there are no ratings for this player then there is no need to create a row else { return null; } $radiantWin = "FALSE"; if($match->get('radiant_win')) { $radiantWin = "TRUE"; } if($asNominal) { $row[] = $this->convertToNominal($averageRating, "RATING"); $row[] = $match->get('match_id'); $row[] = $radiantWin; $row[] = $this->convertToNominal($match->get('duration'), "DURATION"); $row[] = $this->convertToNominal($match->get('first_blood_time'), "FIRST_BLOOD_TIME"); $row[] = $this->convertToNominal($slot->get('hero_id'), "HERO_ID"); $row[] = $this->convertToNominal($slot->get('item_0'), "ITEM_ID"); $row[] = $this->convertToNominal($slot->get('item_1'), "ITEM_ID"); $row[] = $this->convertToNominal($slot->get('item_2'), "ITEM_ID"); $row[] = $this->convertToNominal($slot->get('item_3'), "ITEM_ID"); $row[] = $this->convertToNominal($slot->get('item_4'), "ITEM_ID"); $row[] = $this->convertToNominal($slot->get('item_5'), "ITEM_ID"); $row[] = $this->convertToNominal($slot->get('kills'), "KILLS"); $row[] = $this->convertToNominal($slot->get('deaths'), "DEATHS"); $row[] = $this->convertToNominal($slot->get('assists'), "ASSISTS"); $row[] = $this->convertToNominal($slot->get('gold'), "GOLD"); $row[] = $this->convertToNominal($slot->get('last_hits'), "LAST_HITS"); $row[] = $this->convertToNominal($slot->get('denies'), "DENIES"); $row[] = $this->convertToNominal($slot->get('gold_per_min'), "GOLD_PER_MIN"); $row[] = $this->convertToNominal($slot->get('xp_per_min'), "XP_PER_MIN"); $row[] = $this->convertToNominal($slot->get('gold_spent'), "GOLD_SPENT"); $row[] = $this->convertToNominal($slot->get('hero_damage'), "HERO_DAMAGE"); $row[] = $this->convertToNominal($slot->get('tower_damage'), "TOWER_DAMAGE"); $row[] = $this->convertToNominal($slot->get('hero_healing'), "HERO_HEALING"); $row[] = $this->convertToNominal($slot->get('level'), "LEVEL"); } else { $row[] = $averageRating; $row[] = $match->get('match_id'); $row[] = $radiantWin; $row[] = $match->get('duration'); $row[] = $match->get('first_blood_time'); $row[] = $slot->get('hero_id'); $row[] = $slot->get('item_0'); $row[] = $slot->get('item_1'); $row[] = $slot->get('item_2'); $row[] = $slot->get('item_3'); $row[] = $slot->get('item_4'); $row[] = $slot->get('item_5'); $row[] = $slot->get('kills'); $row[] = $slot->get('deaths'); $row[] = $slot->get('assists'); $row[] = $slot->get('gold'); $row[] = $slot->get('last_hits'); $row[] = $slot->get('denies'); $row[] = $slot->get('gold_per_min'); $row[] = $slot->get('xp_per_min'); $row[] = $slot->get('gold_spent'); $row[] = $slot->get('hero_damage'); $row[] = $slot->get('tower_damage'); $row[] = $slot->get('hero_healing'); $row[] = $slot->get('level'); } return $row; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getSlots($match_id)\r\n {\r\n if (null != $match_id) {\r\n $slots = DB::select(DB::raw(\"SELECT\r\n s.match_id,\r\n s.hero_id,\r\n s.player_slot,\r\n u.personaname AS nickname,\r\n u.steamid,\r\n u.account_id,\r\n m.duration\r\n FROM `slots` AS `s`\r\n LEFT JOIN users AS u ON u.account_id = s.account_id\r\n LEFT JOIN matches AS m ON m.match_id = s.match_id\r\n WHERE s.match_id = \" . $match_id));\r\n\r\n return $slots;\r\n } else {\r\n return null;\r\n }\r\n }", "public function getBySlot($slot);", "private function getData($match)\n {\n return $this->data[$this->key($match)];\n }", "public static function stated($slot)\n {\n return Intent::getSlot($slot);\n }", "public function priceMatching($sender, $param)\n\t{\n\t\t$results = $errors = array();\n\t\ttry\n\t\t{\n\t\t\t$id = isset($param->CallbackParameter->id) ? $param->CallbackParameter->id : '';\n\t\t\t$product = Product::get($id);\n\t\t\t$prices = ProductPrice::getPrices($product, ProductPriceType::get(ProductPriceType::ID_RRP));\n\t\n\t\t\t$companies = PriceMatcher::getAllCompaniesForPriceMatching();\n\t\t\t//$prices = PriceMatcher::getPrices($companies, $product->getSku(), (count($prices)===0 ? 0 : $prices[0]->getPrice()) );\n\t\t\t$prices = PriceMatcher::getMatchPrices($companies, $product->getSku(), (count($prices)===0 ? 0 : $prices[0]->getPrice()) );\n\n\t\t\t$prices['id'] = $id;\n\t\t\t$results = $prices;\n\t\t}\n\t\tcatch(Exception $ex)\n\t\t{\n\t\t\t$errors[] = $ex->getMessage().$ex->getTraceAsString();\n\t\t}\n\t\t$param->ResponseData = StringUtilsAbstract::getJson($results, $errors);\n\t\n\t}", "public function getSlot($slot)\n {\n if( !isset($this->data['id']) )\n {\n throw new E_OTS_NotLoaded();\n }\n\n // loads current item\n $item = $this->db->query('SELECT ' . $this->db->fieldName('itemtype') . ', ' . $this->db->fieldName('sid') . ', ' . $this->db->fieldName('count') . ', ' . $this->db->fieldName('attributes') . ' FROM ' . $this->db->tableName('player_items') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName($slot > POT::SLOT_AMMO ? 'sid' : 'pid') . ' = ' . $slot)->fetch();\n\n if( empty($item) )\n {\n return null;\n }\n\n // checks if there are any items under current one\n $items = array();\n foreach( $this->db->query('SELECT ' . $this->db->fieldName('sid') . ' FROM ' . $this->db->tableName('player_items') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('pid') . ' = ' . $item['sid'])->fetchAll() as $sub)\n {\n $items[] = $this->getSlot($sub['sid']);\n }\n\n // checks if current item is a container\n if( empty($items) )\n {\n $slot = new OTS_Item($item['itemtype']);\n }\n else\n {\n $slot = new OTS_Container($item['itemtype']);\n\n // puts items into container\n foreach($items as $sub)\n {\n $slot->addItem($sub);\n }\n }\n\n $slot->setCount($item['count']);\n $slot->setAttributes($item['attributes']);\n\n return $slot;\n }", "function getMatchsForRes($tieId, $teamL, $teamR)\r\n\t{\r\n\t\t$ut = new utils();\r\n\t\t// Select the matchs of the tie\r\n\t\t$fields = array('mtch_id', 'mtch_discipline', 'mtch_score',\r\n\t\t 'mtch_order', 'mtch_status', 'mtch_disci');\r\n\t\t$tables[] = 'matchs';\r\n\t\t$where = \"mtch_del != \".WBS_DATA_DELETE.\r\n\t\" AND mtch_tieId = $tieId\";\r\n\t\t$order = \"mtch_rank\";\r\n\t\t$res = $this->_select($tables, $fields, $where, $order);\r\n\r\n\t\t// Construc a table with the match\r\n\t\twhile ($match = $res->fetchRow(DB_FETCHMODE_ASSOC))\r\n\t\t{\r\n\t $match['mtch_regiId00'] = -10;\r\n\t $match['mtch_regiId01'] = -10;\r\n\t $match['mtch_regiId10'] = -10;\r\n\t $match['mtch_regiId11'] = -10;\r\n\t $match['mtch_result0'] = WBS_RES_NOPLAY;\r\n\t $match['mtch_result1'] = WBS_RES_NOPLAY;\r\n\t $match['mtch_teamId0'] = $teamL;\r\n\t $match['mtch_teamId1'] = $teamR;\n\t if ($match['mtch_discipline'] < 6) $match['mtch_num'] = $ut->getSmaLabel($match['mtch_discipline']);\n\t else $match['mtch_num'] = 'SP';\n\t $match['mtch_num'] .= ' ' . $match['mtch_order'];\r\n\t $matches[$match['mtch_id']] = $match;\r\n\t\t}\r\n\r\n\t\t// Select the players of the matchs of the tie\r\n\t\t$fields = array('mtch_id', 'regi_id', 'regi_teamId', 'i2p_pairId',\r\n\t\t 'rkdf_label', 'p2m_result');\r\n\t\t$tables = array('matchs', 'p2m', 'i2p', 'registration',\r\n\t\t 'ranks', 'rankdef', 'members');\r\n\t\t$where = \" mtch_del != \".WBS_DATA_DELETE.\r\n\t\" AND mtch_tieId = $tieId\".\r\n\t\" AND mtch_id = p2m_matchId\".\r\n\t\" AND p2m_pairId = i2p_pairId\".\r\n\t\" AND i2p_regiId = regi_id\".\r\n\t\" AND rank_regiId = regi_id\".\r\n\t\" AND rank_rankdefId = rkdf_id\".\r\n\t\" AND rank_discipline = mtch_disci\".\r\n\t\" AND regi_memberId = mber_id\";\r\n\t\t$order = \"mtch_id, regi_teamId, mber_sexe\";\r\n\t\t$res = $this->_select($tables, $fields, $where, $order);\r\n\r\n\t\t// Coomplete the table with player's match\r\n\t\t$uts = new utscore();\r\n\t\t$pairId=-1;\r\n\t\twhile ($player = $res->fetchRow(DB_FETCHMODE_ASSOC))\r\n\t\t{\r\n\t $match = $matches[$player['mtch_id']];\r\n\t $uts->setScore($match['mtch_score']);\r\n\t if ($player['regi_teamId'] == $teamL)\r\n\t {\r\n\t \tif ($pairId != $player['i2p_pairId'])\r\n\t \t{\r\n\t \t\t$match['mtch_regiId00'] = $player['regi_id'];\r\n\t \t\t$match['mtch_result0'] = $player['p2m_result'];\r\n\t \t\t$pairId = $player['i2p_pairId'];\r\n\t \t}\r\n\t \telse\r\n\t\t $match['mtch_regiId01' ] = $player['regi_id'];\r\n\t }\r\n\t else\r\n\t {\r\n\t \tif ($pairId != $player['i2p_pairId'])\r\n\t \t{\r\n\t \t\t$match['mtch_regiId10'] = $player['regi_id'];\r\n\t \t\t$match['mtch_result1'] = $player['p2m_result'];\r\n\t \t\t$pairId = $player['i2p_pairId'];\r\n\t \t}\r\n\t \telse\r\n\t\t $match['mtch_regiId11' ] = $player['regi_id'];\r\n\r\n\t }\r\n\t $matches[$player['mtch_id']] = $match;\r\n\t\t}\r\n\r\n\t\treturn $matches;\r\n\r\n\t}", "public static function searchSlot($slotArray,$value){\r\n //echo 'called me';\r\n// for($i=0; $i< count($slotArray);$i++){\r\n// $findRec = array_search($value, $slotArray[$i]['slot']);\r\n// if($findRec){\r\n// return 1;\r\n// }else{\r\n// return 0;\r\n// }\r\n// }\r\n \r\n foreach($slotArray as $slot){\r\n $findRec = array_search($value, $slot['slot']);\r\n if($findRec){\r\n echo $findRec;\r\n //return 1;\r\n }else{\r\n return 0;\r\n }\r\n }\r\n \r\n echo 'now';\r\n //echo '<pre>';\r\n //print_r($slotArray);\r\n //echo '</pre>';\r\n //print_r($slotArray[0]['slot']);\r\n /*for($i=0; $i< count($slotArray);$i++){\r\n if (in_array($value, $slotArray[$i]['slot'])) {\r\n //echo \"Got it\";\r\n $output = $slotArray[$i]['slot']['time'];\r\n }else{\r\n $output = null;\r\n }\r\n }*/\r\n //echo $output;\r\n //return $output;\r\n //echo count($slotArray);\r\n }", "public function calculatingWinRatesV2($match)\n {\n DataDragonAPI::initByCDN();\n $api = new LeagueAPI([\n LeagueAPI::SET_KEY => GlobalModel::getApiKey(),\n LeagueAPI::SET_REGION => Region::EUROPE_EAST,\n ]);\n $apiKey = GlobalModel::getApiKey();\n \n $winRateArray=[];\n $arA=[];\n $arK=[];\n $arD=[];\n \n for ($i=0; $i<10; $i++)\n {\n //var_dump($i.\"BROJ\");\n $champId=$match->participants[$i]->championId;\n $ime=$match->participants[$i]->summonerName;\n $summoner = $api->getSummonerByName($ime);\n $matchlist = $api->getMatchListByAccount($summoner->accountId, null, null, $champId, null, null, null, null)->matches;\n \n //var_dump(count($matchlist).\" \". $ime);\n $numTotal=0;\n $numWon=0;\n \n $kills=0;\n $deaths=0;\n $assists=0;\n \n $it=0;\n $par = $match->participants[$i];\n $idIgrac=$match->participants[$i]->summonerId;\n for($k=0; $k<count($matchlist); $k++)\n {\n $iMatch = $matchlist[$k];\n //var_dump($iMatch->timestamp);\n \n $it++;\n if ($it==4) break;\n $iChamp=$iMatch->champion;\n \n if ($iChamp==$champId)\n {\n $numTotal++;\n $matchUrl = \"https://eun1.api.riotgames.com/lol/match/v4/matches/\" . $iMatch->gameId . \"?api_key=\". $apiKey;\n $mec = json_decode($this->getHtml($matchUrl));\n \n $tim1=$mec->teams[0];\n $tim2=$mec->teams[1];\n \n foreach ($mec->participantIdentities as $ig)\n {\n if ($ig->player->summonerId!=$idIgrac) continue;\n //$igrac=$mec->participants[$ig->participantId];\n $igrac=null;\n for ($j=0; $j<10; $j++)\n if ($mec->participants[$j]->participantId==$ig->participantId)\n {\n $igrac=$mec->participants[$j];\n break;\n }\n \n $kills+=$igrac->stats->kills;\n $assists+=$igrac->stats->assists;\n $deaths+=$igrac->stats->deaths;\n \n $tim=$igrac->teamId;\n \n if ($tim==$tim1->teamId)\n { \n if ($tim1->win==\"Win\")\n $numWon++;\n \n }\n else\n {\n if ($tim2->win==\"Win\")\n $numWon++;\n }\n }\n }\n \n }\n //var_dump($numWon . \" - \" . $numTotal);\n //echo $ime.\" \".$numTotal.\":\".$numWon.\"\\n\";\n if ($numTotal>0)\n {\n $wr=(int) (100.*($numWon/$numTotal));\n $wr=\"$wr%\";\n }\n else \n $wr=\"None\";\n \n \n array_push($arK, $kills);\n array_push($arA, $assists);\n array_push($arD, $deaths);\n \n array_push($winRateArray, $wr);\n }\n //var_dump($winRateArray);\n $rez=[\"wr\"=>$winRateArray, \"k\"=>$arK, \"a\"=>$arA, \"d\"=>$arD];\n \n return $rez;\n \n }", "public function dataToMatch () : array\r\n\t{\r\n\t\t$pix_one = new Reader('00020101021126860014br.gov.bcb.pix0136285fb964-0087-4a94-851a-5a161ed8888a0224Solicitacao de pagamento52040000530398654041.005802BR5913STUDIO PIGGLY6007Uberaba62070503***63045C9B');\r\n\t\t$pix_two = new Reader('00020101021126780014br.gov.bcb.pix0136285fb964-0087-4a94-851a-5a161ed8888a0216DS PIX PAGAMENTO52040000530398654041.005802BR5913STUDIO PIGGLY6007Uberaba62080504TX01630422D4');\r\n\r\n\t\treturn [\r\n\t\t\t['285fb964-0087-4a94-851a-5a161ed8888a', $pix_one->getPixKey()],\r\n\t\t\t['285fb964-0087-4a94-851a-5a161ed8888a', $pix_two->getPixKey()],\r\n\t\t\t[Parser::KEY_TYPE_RANDOM, Parser::getKeyType($pix_one->getPixKey())],\r\n\t\t\t[Parser::KEY_TYPE_RANDOM, Parser::getKeyType($pix_two->getPixKey())],\r\n\t\t\t['Solicitacao de pagamento', $pix_one->getDescription()],\r\n\t\t\t['DS PIX PAGAMENTO', $pix_two->getDescription()],\r\n\t\t\t['STUDIO PIGGLY', $pix_one->getMerchantName()],\r\n\t\t\t['STUDIO PIGGLY', $pix_two->getMerchantName()],\r\n\t\t\t['Uberaba', $pix_one->getMerchantCity()],\r\n\t\t\t['Uberaba', $pix_two->getMerchantCity()],\r\n\t\t\t[1, $pix_one->getAmount()],\r\n\t\t\t[1, $pix_two->getAmount()],\r\n\t\t\t[StaticPayload::class, get_class($pix_one->export())],\r\n\t\t\t[StaticPayload::class, get_class($pix_two->export())],\r\n\t\t];\r\n\t}", "function getMatchingRides($searchRide)\n{\n\t$result = getFilteredRidesfromDB($searchRide);\n\treturn $result;\n}", "private function matchingData()\n {\n $this->updateKey();\n\n // If the data is an numeric array, each value need to be parse individually\n // and the aggregate results will be returned.\n if ($this->isNumericArray($this->data)) {\n return $this->aggregateFromNumericArray();\n }\n\n // If the selector try to access to a specify value from an array,\n // this value will be returned.\n if ($this->hasIndex()) {\n $this->checkIsNumeric();\n $this->checkIndexExists();\n\n return $this->data[$this->key][$this->index];\n }\n\n // If it try to access a scalar value, it will be returned or null\n // if it doen't exists\n return isset($this->data[$this->key]) ? $this->data[$this->key] : null;\n }", "protected static function base_data(\\bookking_slot $slot) {\n return array(\n 'context' => $slot->get_bookking()->get_context(),\n 'objectid' => $slot->id,\n 'relateduserid' => $slot->teacherid\n );\n }", "public static function get_rating_info($mod, $context, $component, $ratingarea, $items) {\n global $USER;\n\n $ratinginfo = [\n 'contextid' => $context->id,\n 'component' => $component,\n 'ratingarea' => $ratingarea,\n 'canviewall' => null,\n 'canviewany' => null,\n 'scales' => [],\n 'ratings' => [],\n ];\n if ($mod->assessed != RATING_AGGREGATE_NONE) {\n $ratingoptions = new stdClass;\n $ratingoptions->context = $context;\n $ratingoptions->component = $component;\n $ratingoptions->ratingarea = $ratingarea;\n $ratingoptions->items = $items;\n $ratingoptions->aggregate = $mod->assessed;\n $ratingoptions->scaleid = $mod->scale;\n $ratingoptions->userid = $USER->id;\n $ratingoptions->assesstimestart = $mod->assesstimestart;\n $ratingoptions->assesstimefinish = $mod->assesstimefinish;\n\n $rm = new rating_manager();\n $allitems = $rm->get_ratings($ratingoptions);\n\n foreach ($allitems as $item) {\n if (empty($item->rating)) {\n continue;\n }\n $rating = [\n 'itemid' => $item->rating->itemid,\n 'scaleid' => $item->rating->scaleid,\n 'userid' => $item->rating->userid,\n 'rating' => $item->rating->rating,\n 'canrate' => $item->rating->user_can_rate(),\n 'canviewaggregate' => $item->rating->user_can_view_aggregate(),\n ];\n // Fill the capabilities fields the first time (the rest are the same values because they are not item dependent).\n if ($ratinginfo['canviewall'] === null) {\n $ratinginfo['canviewall'] = $item->rating->settings->permissions->viewall &&\n $item->rating->settings->pluginpermissions->viewall;\n $ratinginfo['canviewany'] = $item->rating->settings->permissions->viewany &&\n $item->rating->settings->pluginpermissions->viewany;\n }\n\n // Return only the information the user can see.\n if ($rating['canviewaggregate']) {\n $rating['aggregate'] = $item->rating->aggregate;\n $rating['aggregatestr'] = $item->rating->get_aggregate_string();\n $rating['aggregatelabel'] = $rm->get_aggregate_label($item->rating->settings->aggregationmethod);\n $rating['count'] = $item->rating->count;\n }\n // If the user can rate, return the scale information only one time.\n if ($rating['canrate'] &&\n !empty($item->rating->settings->scale->id) &&\n !isset($ratinginfo['scales'][$item->rating->settings->scale->id])) {\n $scale = $item->rating->settings->scale;\n // Return only non numeric scales (to avoid return lots of data just including items from 0 to $scale->max).\n if (!$scale->isnumeric) {\n $scaleitems = [];\n foreach ($scale->scaleitems as $value => $name) {\n $scaleitems[] = [\n 'name' => $name,\n 'value' => $value,\n ];\n }\n $scale->items = $scaleitems;\n }\n $ratinginfo['scales'][$item->rating->settings->scale->id] = (array) $scale;\n }\n $ratinginfo['ratings'][] = $rating;\n }\n }\n return $ratinginfo;\n }", "protected function getMatchedAttributes($sIdentifier)\n {\n $oVariantMatching = MLDatabase::getVariantMatchingTableInstance();\n $oSelect = MLDatabase::factorySelectClass();\n $aResult = $oSelect->select(\"*\")->from($oVariantMatching->getTableName())\n ->where(array('identifier' => $sIdentifier))->getResult();\n $aData = isset($aResult[0]) ? $aResult[0] : array();\n return empty($aData) ? array() : json_decode($aData['ShopVariation'], true);\n }", "public static function getAdSlotFromDeviceAndVersion($device, $slot_version) {\n // @TODO - We assume banner, which is not necessarily the right thing to do\n return $device.\"-box-ad-\".$slot_version;\n }", "function getReservationData($timestamp, $startHr, $maxHr)\n\t{\n\t\t$day = $timestamp;\n\t\t//hmm\n\t\t$start = $timestamp + (60 * 60 * ($startHr));\n\t\t$dayText = date(\"D, m/j/y g:i a\", $start);\n\t\t$startText = date(\"g:i a\", $start);\n\t\t$availableSlots = array();\n\t\tfor ($x=1; $x<=$maxHr; $x++){\n\t\t\t$end = $start+($x*60*60);\n\t\t\t$s = ($x==1) ? \"\" : \"s\";\n\t\t\t$endText = date(\"g:i a\", $end);\n\t\t\t$availableSlots[] = array(\"totalHours\"=>$x,\"start\" => $start, \"end\" => $end, \"text\"=> $x.\" hour\".$s.\": \".$startText.\"-\".$endText);\n\t\t}\n\t\treturn array(\"dayat6\" => $day,\"min\" => $timestamp+(($startHr)*60*60), \"max\" => $timestamp+(($startHr+1)*60*60), \"dayText\" => $dayText,\"start\" => $start, \"startText\" => $startText, \"slots\" => $availableSlots);\n\t}", "protected function internal_get_match_data($matchId)\n\t{\n\t\t$match = ORM::factory ('ORM_Match', $matchId);\n\t\t$performances = $match->Performances->find_all()->as_array();\n\t\t$performances_array = array();\n\t\tforeach($performances as $performance){\n\t\t\tarray_push($performances_array, $performance->as_array());\n\t\t}\n\t\t$match_array = $match->as_array();\n\t\t$match_array['playerPerformance'] = $performances_array;\n\n\t\treturn $match_array;\n\t}", "function getAllMatchesWithBets($friendlist){\n // Get sql connexion\n global $sql;\n \n $return = array();\n \n // Get all not played matches\n $req = \"SELECT * FROM matches\n WHERE\n status = '\"._PLANNED.\"'\n ORDER BY date\n \";\n $matches = $sql->fetchAssoc($sql->doQuery($req));\n \n // Now for each match, check if the user has already done a bet\n foreach($matches as $match){\n $req = \"SELECT * FROM pronostics\n WHERE\n members_login = '\".mysqli_real_escape_string($sql->dbhandle, $this->login).\"' AND\n matches_id_match = '\".mysqli_real_escape_string($sql->dbhandle, $match['id_match']).\"' AND\n friendlist_name = '\".mysqli_real_escape_string($sql->dbhandle, $friendlist).\"'\n \";\n $bet = $sql->doQuery($req, true);\n // If no bet is found for this match, return it\n $return[] = array( 'match' => $match, \n 'bet' => $bet,\n );\n }\n // Return the matches\n return $return;\n }", "function getBet($matchID, $friendlist){\n global $sql;\n \n return $sql->doQuery(\n \"SELECT *\n FROM\n pronostics\n WHERE\n members_login = '\".mysqli_real_escape_string($sql->dbhandle, $this->login).\"' AND\n matches_id_match = '\".mysqli_real_escape_string($sql->dbhandle, $matchID).\"' AND\n friendlist_name = '\".mysqli_real_escape_string($sql->dbhandle, $friendlist).\"'\n \",\n true\n );\n }", "function mostplayedMatch(){\n\n\t\t$data = array();\n\t\t$data = $this->query(\"select count(*) as totalbets, b.id as bet_id,bp.name as bet_part_name, bp.odd as bet_part_odd, e.league_id, l.name as league_name, s.name as sport_name, l.sport_id,e.id as event_id,e.name as event_name,e.date as event_date FROM bet_parts as bp,bets as b, events as e, leagues as l, sports as s where e.active = 1 and l.active = 1 and s.active = 1 and b.event_id = e.id and l.id = e.league_id and s.id = l.sport_id and b.id = bp.bet_id and e.date >= DATE(NOW()) AND (e.result = '' or e.result = 'NULL') group by e.league_id order by totalbets DESC\");\n\t\treturn $data;\n\t}", "public function getUsedSlots($slotPeriod = 15) {\n $sql = sprintf('SELECT count(*) FROM `orders` WHERE (restaurantId=%d) AND (deliverTime > date_sub(now(),interval %d minute))', $this->getId(), $slotPeriod);\n return $this->getAdapter()->fetchOne($sql);\n }", "function match_making_process($item_id, $account_id)\n {\n $thing_criteria = array(\n '1ST' => 'item_name',\n '2ND' => 'item_category',\n '3RD' => 'item_color',\n '4TH' => 'brand'\n );\n $person_criteria = array(\n '1ST' => 'name',\n '3RD' => 'age_group',\n '4TH' => 'sex',\n );\n $pet_criteria = array(\n '1ST' => 'color',\n '2ND' => 'type',\n '3RD' => 'breed',\n );\n\n\n /* Get the item data */\n $item_data = $this->item->get(array('id' => $item_id));\n $report_type = $item_data['report_type'];\n $report_id = $item_data['item_id'];\n\n $points = array();\n $top_similar_item = array();\n $match_item_count = 0;\n\n /* Get total valid lost item to be check */\n $row_count = $this->item->valid_matchmaking_rows_count($report_type, $account_id);\n $row_ids = $this->item->valid_matchmaking_item_id($report_type, $account_id);\n\n switch ($report_type) {\n case 'Personal Thing':\n /* Get the newly reported found item data */\n $found_item = $this->found_item->get(array('id' => $report_id));\n for ($i=0; $i < $row_count; $i++) {\n $id = $row_ids[$i]['item_id'];\n $lost_item = $this->lost_item->get(array('id', $id));\n $points[$id] = 0;\n\n // $l_item_name_words = explode(\" \",$lost_item[$i][$thing_criteria['1ST']]);\n // $f_item_name_words = explode(\" \", $found_item[$thing_criteria['1ST']]);\n // $item_name_points = 0;\n // for ($x=0; $x < count($l_item_name_words) ; $x++) {\n // for ($z=0; $z < count($f_item_name_words); $z++) {\n // if (strtolower($l_item_name_words[$x]) == strtolower($f_item_name_words[$z])) {\n // $item_name_points++;\n // }\n // }\n // }\n\n /* 2ND Criteria by Item Category*/\n if ($lost_item[$i][$thing_criteria['2ND']] == $found_item[$thing_criteria['2ND']]) {\n $points[$id]++;\n }\n\n /* 3RD Criteria bt Item color */\n if (strtolower($lost_item[$i][$thing_criteria['3RD']]) == strtolower($found_item[$thing_criteria['3RD']])) {\n $points[$id]++;\n }\n\n /* 4TH Criteria bt Item brand */\n if (strtolower($lost_item[$i][$thing_criteria['4TH']]) == strtolower($found_item[$thing_criteria['4TH']])) {\n $points[$id]++;\n }\n }\n\n /* Arranging Top Similar Items */\n foreach ($points as $key => $value) {\n if ($value > 2 && $match_item_count < 4) {\n /* Get Max of Three */\n $top_similar_item[$match_item_count] = $key;\n $match_item_count++;\n }\n }\n // foreach ($top_similar_item as $key => $value) {\n // $item[$key] = $this->item->get(array('conditions' => array(\n // 'type' => 'Lost',\n // 'status' => 'New',\n // 'report_type' => 'Personal Thing',\n // 'account_id !=' => $account_id,\n // 'item_id' => $value\n // )));\n // $match_item[$key] = $item[$key][0]['id'];\n // }\n\n return $top_similar_item? $top_similar_item : false;\n break;\n case 'Person':\n $found_person = $this->person_model->get(array('id' => $report_id));\n for ($i=0; $i < $row_count; $i++) {\n $id = $row_ids[$i]['item_id']; /* Get the lost person id */\n $lost_person = $this->person_model->get(array('id' => $id));\n\n $points[$id] = 0; /* Reset Points */\n\n /* 1st Person Criteria */\n if (strtolower($lost_person[$person_criteria['1ST']]) == strtolower($found_person[$person_criteria['1ST']])) {\n $points[$id]++;\n }\n\n // /* 2nd Person Criteria */\n // if (strtolower($lost_person[$person_criteria['2ND']]) == strtolower($found_person[$person_criteria['2ND']])) {\n // $points[$id]++;\n // }\n\n /* 3rd Person Criteria */\n if ($lost_person[$person_criteria['3RD']] == $found_person[$person_criteria['3RD']]) {\n $points[$id]++;\n } else {\n $points[$id] = 0;\n }\n\n /* 4th Person Criteria */\n if ($lost_person[$person_criteria['4TH']] == $found_person[$person_criteria['4TH']]) {\n $points[$id]++;\n } else {\n $points[$id] = 0;\n }\n\n }\n /* Arranging Top Similar Items */\n foreach ($points as $key => $value) {\n if ($value > 2 && $match_item_count < 4) {\n /* Get Max of Three */\n $top_similar_item[$match_item_count] = $key;\n $match_item_count++;\n }\n }\n return $top_similar_item? $top_similar_item : false;\n break;\n case 'Pet':\n $found_pet = $this->pet_model->get(array('id' => $report_id));\n for ($i=0; $i < $row_count; $i++) {\n $id = $row_ids[$i]['item_id']; /* Get the lost pet id */\n $lost_pet = $this->pet_model->get(array('id' => $id));\n\n $points[$id] = 0; /* Reset Points */\n\n // /* 1st Pet Criteria */\n // if (strtolower($lost_pet[$pet_criteria['1ST']]) == strtolower($found_pet[$pet_criteria['1ST']])) {\n // $points[$id]++;\n // }\n\n /* 2nd Pet Criteria */\n if ($lost_pet[$pet_criteria['2ND']] == $found_pet[$pet_criteria['2ND']]) {\n $points[$id]++;\n } else {\n $points[$id] = 0; /* This new found is not match */\n }\n\n // /* 3RD Pet Criteria */\n if (strtolower($lost_pet[$pet_criteria['3RD']]) == strtolower($found_pet[$pet_criteria['3RD']])) {\n $points[$id]++;\n }\n }\n\n /* Arranging Top Similar Items */\n foreach ($points as $key => $value) {\n if ($value > 1 && $match_item_count < 4) {\n /* Get Max of Three */\n $top_similar_item[$match_item_count] = $key;\n $match_item_count++;\n }\n }\n return $top_similar_item? $top_similar_item : false;\n break;\n\n }\n }", "function getAllMatchesToBet($friendlist){\n // Get sql connexion\n global $sql;\n // Get all not played matches\n $req = \"SELECT * FROM matches\n WHERE\n status = '\"._PLANNED.\"'\n ORDER BY date\n \";\n $res = $sql->doQuery($req);\n $matches = $sql->fetchAssoc($res);\n \n // Now for each match, check if the user has already done a bet\n $return = array();\n foreach($matches as $match){\n $req = \"SELECT * FROM pronostics\n WHERE\n members_login = '\".mysqli_real_escape_string($sql->dbhandle, $this->login).\"' AND\n matches_id_match = '\".mysqli_real_escape_string($sql->dbhandle, $match['id_match']).\"' AND\n friendlist_name = '\".mysqli_real_escape_string($sql->dbhandle, $friendlist).\"'\n \";\n $bet = $sql->doQuery($req, true);\n // If no bet is found for this match, return it\n if (!$bet){\n $return[] = $match;\n }\n }\n // Return the matches\n return $return;\n }", "abstract public function getRating();", "public function getStarRating()\n {\n $ratings = $this->owner->PageRatingResults();\n $rating = 0;\n if ($ratings->Count() == 1) {\n foreach ($ratings as $ratingItem) {\n $rating = $ratingItem->Stars;\n }\n }\n return $rating;\n }", "public function goalsInMatch(Match $match)\n {\n return $this->matches->filter(function ($m) use ($match) {\n return $m->is($match);\n })->first()->pivot->goals;\n }", "public function matchwithperiod()\n {\n\n $user = Studentinfo::all()->where('roundNumber', (int)$this->roundnumber);\n //get free student\n\n $Qsize = $user->where('QorR', 1)->count();\n $Rsize = $user->where('QorR', 0)->count();\n\n if ($Qsize > $Rsize) {\n $questioner = $user->where('QorR', 1)->take($Rsize);\n $respondent = $user->where('QorR', 0)->take($Rsize);\n } else {\n $questioner = $user->where('QorR', 1)->take($Qsize);\n $respondent = $user->where('QorR', 0)->take($Qsize);\n }\n foreach ($questioner as $qr) {\n $qr->QorR = 0;\n $qr->save();\n\n }\n foreach ($respondent as $qr) {\n $qr->QorR = 1;\n $qr->save();\n\n }\n\n $questioner = $questioner->shuffle();\n $respondent = $respondent->shuffle();\n $sorted = $questioner->sortBy(function ($product, $key) {\n return $product['gradeH'] - $product['gradeL'];\n });\n\n\n $res = collect();\n $sorted = $sorted->values();\n\n foreach ($sorted as $q) {\n $f = $q['gradeL'];\n $c = $q['gradeH'];\n\n foreach ($respondent as $r) {\n if ($r['finalScore'] < $c && $r['finalScore'] > $f) {\n $resp = $respondent->pull($respondent->search($r));\n\n $temp = collect(['questioner' => $q, 'respondent' => $resp]);\n $res->push($temp);\n $sorted->pull($sorted->search($q));\n break;\n }\n }\n }\n\n foreach ($sorted as $s) {\n $f = $s['gradeL'];\n $c = $s['gradeH'];\n $min = 100;\n\n foreach ($respondent as $r) {\n\n $rGrade = $r['finalScore'];\n $diff = abs($f - $rGrade);\n $difc = abs($c - $rGrade);\n if ($difc < $min) {\n $min = $diff;\n $resres = $r;\n } else {// todo else if bood k=je baresh dashtam\n $min = $difc;\n $resres = $r;\n }\n }\n\n//dd($resres);\n $resp = $respondent->pull($respondent->search($resres));\n //dd($resp);\n $temp = collect(['questioner' => $s, 'respondent' => $resp]);\n $res->push($temp);\n $sorted->pull($sorted->search($s));\n }\n return $res;\n }", "public function getMatch():array\n {\n $stmt = self::connectToDb()->prepare('SELECT * FROM matches WHERE id = :id ');\n $stmt->bindParam(':id',$this->id);\n $stmt->execute();\n return $stmt->fetchAll();\n }", "public function matchIntent($session, GoogleCloudDialogflowCxV3MatchIntentRequest $postBody, $optParams = [])\n {\n $params = ['session' => $session, 'postBody' => $postBody];\n $params = array_merge($params, $optParams);\n return $this->call('matchIntent', [$params], GoogleCloudDialogflowCxV3MatchIntentResponse::class);\n }" ]
[ "0.6034565", "0.570403", "0.52189624", "0.48729414", "0.48430234", "0.4811818", "0.47452646", "0.47121558", "0.46931016", "0.46622154", "0.46320736", "0.46150127", "0.45455372", "0.45275906", "0.44871667", "0.44810545", "0.4448209", "0.4441106", "0.4440977", "0.4425214", "0.4424482", "0.4417376", "0.4415936", "0.44011983", "0.4393014", "0.4389", "0.43886167", "0.43761143", "0.43691504", "0.43638262" ]
0.6527041
0
Terminal number as defined for the merchant at CG Gateway within the integration process
public function getTerminalNumber() { return $this->get('terminalNumber'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getTestTerminalId(){\n return self::DEFAULT_MERCHANT_ID;\n }", "public function getTerminalid ()\n {\n return $this->getConfigData('terminalid');\n }", "public function setTerminalNumber(string $value) { return $this->set('terminalNumber', $value); }", "private function getMerchantID()\n\t{\n\t\t$sandbox = $this->params->get('sandbox', 0);\n\n\t\tif ($sandbox)\n\t\t{\n\t\t\treturn 'SCNet_Cert6';\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn trim($this->params->get('merchant_id', ''));\n\t\t}\n\t}", "static public function get_clickbank_receipt_number() {\r\n\t\t\t$options = self::get_options();\r\n\t\t \treturn $options['clickbank_receipt_number'];\r\n\t\t}", "public function getCardNumber() : string\n {\n return $this->card_number;\n }", "private function generateConsignmentNumber(){\n return Courier::generateConsignmentNumber($this->courierId);\n }", "function getStripeAccountNumber();", "public function getSerialNumber()\n {\n $script = 'app.serialNumber';\n $return = $this->client->simpleRunScript($script);\n\n return (string)$return->data;\n }", "public function getNewInvoiceNo(){\n $prefix = \"MAS\";\n $year = substr(CustomHelper::getSessionList()['currentSession'],2);\n $currentSession = CustomHelper::getSessionList()['currentSession'];\n $serialNo = FeeReceived::where('for_session',$currentSession)->max('invoice_serial_no');\n return $prefix.\"/\".$year.\"/\".($serialNo+1);\n }", "public function getAccNumber(): string\n {\n return $this->accNumber;\n }", "function Number()\r\n\t{\r\n\t\treturn $this->_ccNum;\r\n\t}", "public function getCardNumber();", "public function getSerialNumber();", "public function getPaymentAccountNumber(): string {\n return $this->paymentAccountNumber;\n }", "public function getPurchaseOrderNumber();", "public function getTestFindomesticTerminalId(){\n return null;\n }", "public function getWalletNumber()\n {\n /**\n * 1 - Cobrança Simples\n * 3 - Garantias de Operações Quando o cliente optar por trabalhar diretamente nesta carteira de cobrança, o boleto poderá não ser aceito para compor a carteira ‘03’, desta forma ele será registrado na carteira ‘00 – Cobrança Simples’, sendo que no arquivo retorno será informado a carteira em que o boleto foi acatado.\n * 4 - Desconto Suspenso (somente para arquivo Retorno )\n */\n return 1;\n }", "public function getOurNumber(): string\n {\n return $this->ourNumber;\n }", "private function getAccountNumber()\n {\n\n $number = 0;\n\n for ($i = 0; $i < Settings::getSetting('syscrack_bank_accountnumber_length'); $i++)\n {\n\n $number = $number . rand(0,9);\n }\n\n return $number;\n }", "public function generateInvoiceNumber();", "public function getTerminalidTwo ()\n {\n return $this->getConfigData('terminalidtwo');\n }", "public function getSerialNumber()\n {\n return str_replace('-', '', parent::getSerialNumber());\n }", "public function getReceiptNumber()\n {\n return $this->receiptNumber;\n }", "public function getCustomerErpNumber()\n {\n $customer = $this->getCustomer();\n return Customer::getCustomerNumber($customer);\n }", "public function getCustomerNumber()\n {\n return $this->data['transaction']['x_cust_id'];\n }", "public function getAccountNumber(): string\n {\n return $this->accountNumber;\n }", "public function getNational_number() {\r\n\t\treturn $this->national_number;\r\n\t}", "public function getNumber(): string\n {\n return $this->number;\n }", "public function BankNum()\n {\n // $r2 = mt_rand(0, 10);\n // $start .= strval($r1) . \"\" . strval($r2);\n\n // $count = 0;\n // $n = 0;\n\n // for ($i = 0; $i < 12; $i++) {\n // if ($count == 4) {\n // $start .= \" \";\n // $count = 0;\n // } else {\n // $n = mt_rand(0, 10);\n // $start .= strval($n);\n // $count++;\n // }\n // }\n\n $start =strtoupper ( bin2hex((random_bytes(7))));\n\n return $start;\n }" ]
[ "0.72481203", "0.6815096", "0.64484435", "0.5967198", "0.59560674", "0.58436817", "0.58256966", "0.5822394", "0.5815039", "0.5728285", "0.5718137", "0.566027", "0.5656059", "0.565576", "0.56528753", "0.56474465", "0.56327724", "0.56261367", "0.5592949", "0.55895346", "0.5574392", "0.55270815", "0.55266446", "0.55202305", "0.55132085", "0.5496271", "0.5495647", "0.54742014", "0.5467357", "0.5464288" ]
0.74406356
0
The authorization number from the credit company. This is used only to enter authorization numbers received by the credit company via phone or previous authorization transactions.
public function getAuthNumber() { return (string)$this->get('authNumber'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAccNumber(): string\n {\n return $this->accNumber;\n }", "public function getAuthorizationCode()\n {\n return $this->authorizationCode;\n }", "public function getAuthorizationCode()\n {\n return $this->getParameter('authorizationCode');\n }", "public function getAuthCode()\n {\n return $this->authcode;\n }", "public function getAuthCode() : string\n {\n return $this->authCode;\n }", "public function getCreditorCode()\n {\n return $this->CreditorCode;\n }", "private function getCreditIdByCompanyId()\n {\n if ($this->customerProvider->getCurrentUserCredit()) {\n return $this->customerProvider->getCurrentUserCredit()->getId();\n }\n\n return 0;\n }", "public function getCardAuthCode()\n {\n $cardAuthCode = $this->data->xpath($this->namespace . '/ns2:cardAuthCode');\n\n return isset($cardAuthCode[0])\n ? (string) $cardAuthCode[0]\n : null;\n }", "public function getAccountNumber(): string\n {\n return $this->accountNumber;\n }", "public function getCompanyNumber()\n {\n return $this->companyNumber;\n }", "public function getAccountNumber()\n {\n return $this->getParameter('accountNumber');\n }", "public function getLegalNumber()\n {\n return $this->legal_number;\n }", "public function getAccountNumber()\n {\n return $this->account_number;\n }", "public function getAccountNumber(): string;", "public function getAccountNumber()\n {\n return $this->accountNumber;\n }", "public function getAccountNumber()\n {\n return $this->storage->getData('account_number');\n }", "public function getAccountCode()\n {\n return $this->account_code;\n }", "public function getAccountNumber()\n {\n return $this->bankAccount->getAccountNumber();\n }", "public function getAccountNumber()\n {\n return $this->bankAccount->getAccountNumber();\n }", "public function getCreditInvoiceCode()\n {\n return $this->CreditInvoiceCode;\n }", "public function get_company_code(){\n\t\treturn $this->v_company_code;\n\t}", "function Number()\r\n\t{\r\n\t\treturn $this->_ccNum;\r\n\t}", "public function getAccountNo()\n {\n return $this->accountNo;\n }", "public function getAccountingID() {\n return $this->getParameter('accounting_id');\n }", "public function getAccountingID() {\n return $this->getParameter('accounting_id');\n }", "public function getAcCode()\n {\n return $this->ac_code;\n }", "public function getAccountingID(){\n return $this->getParameter('accounting_id');\n }", "public function get_company_id(){\n\t\treturn (int) $this->v_company_id;\n\t}", "public function getIdFromAccountNumber()\n {\n return $this->_extractIdFromNumber($this->account_number);\n }", "public function setAuthNumber($value) { return $this->set('authNumber', $value); }" ]
[ "0.69665277", "0.6778084", "0.6582916", "0.6570933", "0.6555471", "0.63175833", "0.6296135", "0.62723297", "0.6190975", "0.6183724", "0.6128362", "0.6098741", "0.60969985", "0.60567963", "0.6043633", "0.60434926", "0.5995418", "0.5977215", "0.5977215", "0.59762794", "0.5941639", "0.5940064", "0.59129256", "0.5891183", "0.5891183", "0.5888274", "0.58365756", "0.5792312", "0.5781894", "0.57792807" ]
0.7043672
0
The source of the authorization (ABS, manual, credit company).
public function getAuthSource() { return (string)$this->get('authSource'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAuthSource() {\n\t\treturn NULL;\n\t}", "public function getSource()\n {\n return 'qodr_ref_acl';\n }", "function getRedirectSource()\n\t{\n\t\treturn $_GET[\"redirectSource\"];\n\t}", "public function getSource()\n {\n return 'alcance';\n }", "public function get_permission_origin_description() {\n\n\t\tswitch($this->global_perm) {\n\t\t\tcase PERMS_R_STREAM: return t('This is your default setting for the audience of your normal stream, and posts.');\n\t\t\tcase PERMS_R_PROFILE: return t('This is your default setting for who can view your default channel profile');\n\t\t\tcase PERMS_R_ABOOK: return t('This is your default setting for who can view your connections');\n\t\t\tcase PERMS_R_STORAGE: return t('This is your default setting for who can view your file storage and photos');\n\t\t\tcase PERMS_R_PAGES: return t('This is your default setting for the audience of your webpages');\n\t\t\tdefault: return '';\n\t\t}\n\t}", "abstract public function getAuthorizationUrl();", "public function generateAuthorizationCode(): string;", "public function getAuthorizationURL()\n {\n return $this->get('AuthorizationURL');\n }", "public function getAuthorizationURL()\n {\n return $this->get('AuthorizationURL');\n }", "public function getAuthorizationCode()\n {\n return $this->authorizationCode;\n }", "function authorize_url();", "public function getAccessCode()\n\t{\n\t\t$str = Util::baseEncode($this->id, 'letters');\n\t\t$str .= $this->auth;\n\n\t\treturn $str;\n\t}", "public function getBaseAuthorizationUrl() : string\n {\n return $this->urlAuthorize;\n }", "public function getAuthorizationCode()\n {\n return $this->getParameter('authorizationCode');\n }", "public function getConnectionSource()\n\t{\n\t\t\n\t\treturn $this->session[\"auth_source\"] ;\n\t}", "function Get_Auth_Code()\n\t{\n\t\t$code = \"\";\n\t\t\n\t\tif(isset($_COOKIE['AuthLog']))\n\t\t{\n \t\t$code = $_COOKIE['AuthLog'];\n\t\t}\n\t\t\n\t\treturn $code;\n\t}", "public function getAcCode()\n {\n return $this->ac_code;\n }", "public function getSource(): string\n {\n return 'company_users';\n }", "public function getAuthCode() : string\n {\n return $this->authCode;\n }", "abstract public function getBaseAuthorizationUrl();", "function origin_theme_credit()\n {\n $website = apply_filters('origin_theme_author_credit_url', 'https://indigotree.co.uk');\n $name = apply_filters('origin_theme_author_credit_name', 'Indigo Tree');\n\n return 'Built by <a href=\"'.esc_url($website).'\" target=\"_blank\" rel=\"noopener\">'.$name.'</a>';\n }", "public function authorize(Request $request, $source);", "public function getAuthorizationPageUrl(): string;", "public function authLink() {\n\n $param = array(\n 'response_type' => 'code',\n 'scope' => 'notify',\n 'state' => 'NO_STATE',\n 'client_id' => $this->client_id,\n 'redirect_uri' => $this->callback_url\n );\n\n return LineNotify::AUTHORIZE_URI .'?'. http_build_query($param);\n }", "public function getAuthorizeURL()\n {\n return $this->get('AuthorizeURL');\n }", "public function authorize()\n {\n return true; //cambio provisional LAR17 ->70\n }", "final function source(): string { return $this->source; }", "public function getCreditorCode()\n {\n return $this->CreditorCode;\n }", "public function getAuthorizationUrl()\n {\n return $this->getProvider()->getAuthorizationUrl();\n }", "function getAuthorizationUrl()\n {\n return $this->provider->getAuthorizationUrl([\n 'scope' => [\n 'https://www.googleapis.com/auth/contacts.readonly',\n ]\n ]);\n }" ]
[ "0.63926715", "0.6340345", "0.583078", "0.5808644", "0.5740792", "0.5715312", "0.5711948", "0.5695789", "0.5695789", "0.5695437", "0.56931216", "0.56392914", "0.5637135", "0.56274563", "0.56246406", "0.5591691", "0.556522", "0.55501205", "0.55321544", "0.55268824", "0.5504671", "0.5498024", "0.54463625", "0.5433842", "0.5429397", "0.54271716", "0.5425858", "0.54087657", "0.54029375", "0.5386764" ]
0.6786418
0
Amount of first payment
public function getFirstPayment() { return $this->get('firstPayment'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAmountPaid();", "public function getTotalAmount();", "public function calculate_total_paid(){\r\n $this->total_paid = 0;\r\n foreach($this->payments as $payment){\r\n $this->total_paid += $payment->getAmount();\r\n }\r\n return $this->total_paid;\r\n }", "public function paymentTotal()\n {\n return $this->payments->total();\n }", "public function getFirstServiceChargeAmount()\n\t{\n\t\treturn $this->fee_amount;\n\t}", "public function amount(){\n switch ($this->status){\n\n case 'pendent'; case 'payed' : return $this->amount;\n case 'parcial'; case 'overdue' : return (\n $this->amount - $this->sumOfPayments()\n );\n\n }\n }", "public function getTotalAmount(){\n $total_amount =Payment::sum('paid')->get();\n return $total_amount;\n }", "public function getAmount()\n {\n return $this->data['ik_payment_amount'];\n }", "abstract public function amount();", "public function getAmount();", "public function getAmount();", "public function getAmount();", "public function getAmount();", "public function getAmount();", "public function getAmount();", "public function getPaymentAmt()\n\t{\n\t\treturn $this->PaymentAmt;\n\t}", "public function get_amount()\n {\n return $this->amount;\n }", "public function getAmount()\n {\n /*\n * Return payment amount (in cents)\n */\n $amount = 666;\n\n return $amount;\n }", "public function calculate_total_amount()\n {\n $this->interest= ($this->principal*$this->interest_rate)/100;\n $this->total_interest = $this->year*$this->interest;\n $this->total_amount=$this->total_interest+$this->principal;\n //return $total_amount;\n }", "public function calculatePay()\r\n {\r\n return;\r\n }", "public function getDecoctionAmt();", "public function getTransactionAmount() : float;", "public function getAmount(){\r\n return $this->amount;\r\n }", "public function getAmount(): float;", "private function total_payment_count(){\n $payment = $this->Payment_model->total_payment();\n\n //Employee Salary\n $sallary = $this->Salary_model->total_sallary();\n\n return $payment->amount + $sallary->amount;\n }", "public function getAmount(){\n return $this->amount;\n }", "public function getAmount(){\n return $this->amount;\n }", "public function getAmount()\n {\n return $this->__get(\"amount\");\n }", "public function getAmountRefunded();", "public function getTotalAmount()\r\n {\r\n return $this->totalAmount;\r\n }" ]
[ "0.6808803", "0.6755311", "0.6731201", "0.6695784", "0.66888636", "0.6654158", "0.6644964", "0.65822935", "0.6572543", "0.6549313", "0.6549313", "0.6549313", "0.6549313", "0.6549313", "0.6549313", "0.65420014", "0.6467546", "0.64653945", "0.6463653", "0.64583355", "0.6435673", "0.63742566", "0.6374042", "0.637335", "0.6372221", "0.63407063", "0.63407063", "0.6323909", "0.6303319", "0.6302886" ]
0.67727435
1
IMPORTAR ENTRADAS [tipo_importacion cargamos la vista para elegir el tipo de archivo que vamos a importar]
public function tipo_importacion(){ //datos comunes de las vistas $datos_vista = $this->cargar_datos(); //definimos el paso en que nos encotramos $datos_vista['paso'] = 'tipo-importacion'; //tipos de importacion queda definido por el logo de la pagina desde donde se ha exportado el archivo $datos_vista['logos-importar-entradas'] = $this->imagenes_importar_entradas(); return return_vistas('blogs.importar-entradas', $datos_vista); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _metatag_importer_import(array $types = array()) {\n $batch = array(\n 'title' => t('Importing Nodewords data..'),\n 'operations' => array(\n array('_metatag_importer_migrate', array($types)),\n ),\n 'finished' => '_metatag_importer_finished',\n 'file' => drupal_get_path('module', 'metatag_importer') . '/metatag_importer.nodewords.inc',\n );\n batch_set($batch);\n\n // Kick off the batch.\n batch_process();\n}", "function importarArquivo() {\n \n $sMsgErro = \"Importação de Arquivo Censo abortada!\\n\"; \n if (!db_utils::inTransaction()) {\n throw new Exception(\"Nenhuma transação do banco encontrada!\");\n }\n \n $this->sNomeArquivoLog = \"tmp/censo\".$this->iAnoEscolhido.\"_importacao_\".db_getsession(\"DB_coddepto\").\"_\";\n $this->sNomeArquivoLog .= db_getsession(\"DB_id_usuario\").\"_\".date(\"dmY\").\"_\".date(\"His\").\"_log.txt\";\n \n $this->pArquivoLog = fopen($this->sNomeArquivoLog, \"w\"); \n if (!$this->pArquivoLog) {\n throw new Exception(\" Não foi possível abrir o arquivo de log! \"); \n } \n \n if ($this->lIncluirAlunoNaoEncontrado) { \n $this->log(\"Registros atualizados na importação do Censo Escolar:\\n\\n\");\n } else {\n $this->log(\"Registros não atualizados na importação do Censo Escolar:\\n\\n\"); \n }\n \n try {\n \n $this->validaArquivo(); \n $this->getLinhasArquivo($this->iCodigoLayout); \n $aLinhasArquivo = $this->getLinhasArquivo();\n \n \n } catch (Exception $eException) {\n throw new Exception($sMsgErro.\" \".$eException->getMessage());\n }\n \n foreach ($aLinhasArquivo as $iIndLinha => $oLinha) {\n \t\n if ($this->lImportarEscola) {\n \t\n \tif ($oLinha->tiporegistro == \"00\") {\n \t $this->atualizaCodigoInepEscola($oLinha);\n \t}\n \t\n }\t\n \n if ($this->lImportarTurma) {\n \t\n \tif ($oLinha->tiporegistro == \"20\") {\n \t $this->atualizaCodigoInepTurma($oLinha);\n \t}\n \t\n }\n \n if ($this->lImportarDocente) {\n \t\n \tif ($oLinha->tiporegistro == \"30\") {\n \t $this->atualizaCodigoInepDocente($oLinha);\n \t}\n \t\n }\n \n if ($this->lImportarAluno) {\n \t\n \tif ($oLinha->tiporegistro == \"60\") {\n \t $this->atualizaCodigoInepAluno($oLinha);\n \t}\n \t\n }\n \n }\n\n }", "public function executeImportarEjercicios()\n {\n $this->errors = array();\n $mensaje_importar = '';\n\n // Si se ha hecho submit procesamos el formulario\n if ($this->getRequest()->getMethod() == sfRequest::POST) {\n if ($this->getRequest()->getFileName('my_file')) {\n if (is_readable($_FILES['my_file']['tmp_name'])) {\n $my_file = $_FILES['my_file']['tmp_name'];\n $id_materia = $this->getRequestParameter('materia');\n $xml = simplexml_load_file($my_file);\n if (!$xml) {$this->errors[] = 'Fichero XML incorrecto - fallo en load'; return;}\n\n $ejercicio = new Ejercicio();\n $solucion_ejercicio = new Ejercicio_resuelto();\n\n if ($xml->getName() != 'ejercicio') {$this->errors[] = 'Fichero XML incorrecto - fallo en esquema 1'; return;}\n\n $id_admin = $this->getUser()->getAnyId();\n $solucion_ejercicio->setIdAutor($id_admin);\n $ejercicio->setIdAutor($id_admin);\n $ejercicio->setIdMateria($id_materia);\n $ejercicio->setNombreAutor((string) $xml['nombre_autor']);\n $tipo = $xml['tipo'];\n $ejercicio->setTipo((string) $xml['tipo']);\n $ejercicio->setTitulo((string) $xml['titulo']);\n $ejercicio->setTestMultiple((int) $xml['test_multiple']);\n $ejercicio->setTestResta((int) $xml['test_resta']);\n $numero_respuestas_test = (int) $xml['numero_respuestas'];\n $ejercicio->setNumeroRespuestas($numero_respuestas_test);\n $ejercicio->setSolucion((int) $xml['solucion']);\n $ejercicio->setExpresionesMatematicas((int) $xml['expresiones_matematicas']);\n $ejercicio->setNumeroHojas((int) $xml['numero_hojas']);\n\n $expmat = $ejercicio->getExpresionesMatematicas();\n\n $array_cuestiones = array();\n $array_soluciones = array();\n $index1 = 0;\n\n foreach ($xml->children() as $cuestion) {\n if ($cuestion->getName() != 'cuestion') {$this->errors[] = 'Fichero XML incorrecto - fallo en esquema 2'; return;}\n\n switch ($tipo) {\n case 'test':\n $enunciado = (string) $cuestion->pregunta;\n $cref = new Cuestion_test();\n $cref->setPregunta($enunciado);\n $cref->setNumeroRespuestasCorrectas((int) $cuestion['ncorrectas']);\n $cref->setNumeroRespuestasIncorrectas((int) $cuestion['nincorrectas']);\n $array_cuestiones[$index1] = $cref;\n\n $index2 = 0;\n foreach ($cuestion->respuestas->respuesta as $respuesta) {\n $rref = new Respuesta_cuestion_test();\n if ($respuesta['correcta']) {\n $correcta = (int) $respuesta['correcta'];\n } else {\n $correcta = 0;\n }\n $rref->setCorrecta($correcta);\n $rref->setRespuesta((string) $respuesta);\n $array_soluciones[\"$index1.$index2\"] = $rref;\n $index2++;\n }\n $index1++;\n break;\n\n case 'cuestionario':\n $enunciado = (string) $cuestion->pregunta;\n $puntuacion = (string) $cuestion['puntuacion'];\n\n $cref = new Cuestion_corta();\n $cref->setPregunta($enunciado);\n $cref->setPuntuacion($puntuacion);\n $array_cuestiones[] = $cref;\n\n $solucion = (string) $cuestion->solucion;\n $sref = new Respuesta_cuestion_corta();\n $sref->setRespuesta($solucion);\n $array_soluciones[] = $sref;\n break;\n\n case 'problemas':\n $enunciado = (string) $cuestion->pregunta;\n $puntuacion = (string) $cuestion['puntuacion'];\n\n $cref = new Cuestion_practica();\n $cref->setContenidoLatex($enunciado);\n $cref->setPuntuacion($puntuacion);\n $array_cuestiones[] = $cref;\n break;\n default: break;\n }\n }\n // Bucle2\n switch ($tipo) {\n case 'test':\n $ejercicio->save();\n $solucion_ejercicio->setIdEjercicio($ejercicio->getId());\n $solucion_ejercicio->save();\n $ejercicio->setIdSolucion($solucion_ejercicio->getId());\n $ejercicio->save();\n\n $index1 = 0;\n foreach ($array_cuestiones as $cref) {\n $cref->setIdEjercicio($ejercicio->getId());\n $cref->save();\n\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(1, 't', $cref->getId(), $cref->getPregunta());\n }\n for ($index2 = 0; $index2 < $numero_respuestas_test; $index2++) {\n $rref = $array_soluciones[\"$index1.$index2\"];\n $rref->setIdCuestionTest($cref->getId());\n $rref->save();\n\n if ($rref->getCorrecta()) {\n $sref = new Seleccion_cuestion_test();\n $sref->setIdEjercicioResuelto($solucion_ejercicio->getId());\n $sref->setIdRespuestaCuestionTest($rref->getId());\n $sref->save();\n }\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(0, 't', $rref->getId(), $rref->getRespuesta());\n }\n }\n $index1++;\n }\n break;\n\n case 'cuestionario':\n // Guardamos el ejercicio y sus preguntas si todo fue bien\n $ejercicio->save();\n $solucion_ejercicio->setIdEjercicio($ejercicio->getId());\n $solucion_ejercicio->save();\n $ejercicio->setIdSolucion($solucion_ejercicio->getId());\n $ejercicio->save();\n\n for ($index = 0; $index < sizeof($array_cuestiones); $index++) {\n $cref = $array_cuestiones[$index];\n $cref->setIdEjercicio($ejercicio->getId());\n $cref->save();\n\n $sref = $array_soluciones[$index];\n $sref->setIdCuestionCorta($cref->getId());\n $sref->setIdEjercicioResuelto($solucion_ejercicio->getId());\n $sref->save();\n\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(1, 'c', $cref->getId(), $cref->getPregunta());\n $this->crearExpMat(0, 'c', $sref->getId(), $sref->getRespuesta());\n }\n }\n break;\n\n case 'problemas':\n // Guardamos el ejercicio y sus preguntas si todo fue bien\n $ejercicio->save();\n $solucion_ejercicio->setIdEjercicio($ejercicio->getId());\n $solucion_ejercicio->save();\n $ejercicio->setIdSolucion($solucion_ejercicio->getId());\n $ejercicio->save();\n\n for ($index = 0; $index < sizeof($array_cuestiones); $index++) {\n $cref = $array_cuestiones[$index];\n $cref->setIdEjercicio($ejercicio->getId());\n $cref->save();\n\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(1, 'p', $cref->getId(), $cref->getContenidoLatex());\n }\n }\n break;\n default: break;\n }\n $mensaje_importar = '<strong>El ejercicio \"'.$ejercicio->getTitulo().'\" importado satisfactoriamente</strong>';\n $this->ejercicio = $ejercicio; // necesario para los test\n }\n }\n }\n $c = new Criteria();\n $this->materias = MateriaPeer::DoSelect($c);\n $this->errors = $this->errors;\n $this->mensaje_importar = $mensaje_importar;\n }", "function import($archivo, $recursivo=true)\n{\n\tglobal $CFG;\n\t$ruta = $CFG->libdir.\"/\".$archivo;\n\tif(file_exists($ruta) && !is_dir($ruta))\n\t{\n\t\tinclude_once($ruta);\n\t}\n\telseif(is_dir($ruta))\n\t{\n\t\t$all = scandir($ruta);\n\t\tforeach($all as $key=>$val)\n\t\t{\n\t\t\tif($val != \".\" && $val != \"..\")\n\t\t\t{\n\t\t\t\tif(is_dir($ruta.\"/\".$val) && $recursivo)\n\t\t\t\t{\n\t\t\t\t\timport($archivo.\"/\".$val,true);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(substr($val,-4)==\"php5\" || substr($val,-3)==\"php\")\n\t\t\t\t\t\tinclude_once($ruta.\"/\".$val);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\techo \"La ruta de importacion: <b>\".$ruta.\"</b> es errada<br>\";\n\t}\n}", "function importer_spip_partenaires_types() {\n\n\t######## VERIFIEZ LE NOM DE LA TABLE D'INSERTION ###########\n\t$table = 'spip_partenaires_types';\n\n\t// nom_du_champ_source => nom_du_champ_destination\n\t// mettre vide la destination ou supprimer la ligne permet de ne pas importer la colonne.\n\t$correspondances = array(\n\t\t'id_type' => 'id_type',\n\t\t'titre' => 'titre',\n\t\t'descriptif' => 'descriptif',\n\t\t'maj' => 'maj',\n\t);\n\n\t// transposer les donnees dans la nouvelle structure\n\t$inserts = array();\n\tlist($cles, $valeurs) = donnees_spip_partenaires_types();\n\t// on remet les noms des cles dans le tableau de valeur\n\t// en s'assurant de leur correspondance au passage\n\tif (is_array($valeurs)) {\n\t\tforeach ($valeurs as $v) {\n\t\t\t$i = array();\n\t\t\tforeach ($v as $k => $valeur) {\n\t\t\t\t$cle = $cles[$k];\n\t\t\t\tif (isset($correspondances[$cle]) and $correspondances[$cle]) {\n\t\t\t\t\t$i[ $correspondances[$cle] ] = $valeur;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$inserts[] = $i;\n\t\t}\n\t\tunset($valeurs);\n\n\t\t// inserer les donnees en base.\n\t\t$nb_inseres = 0;\n\t\t// ne pas reimporter ceux deja la (en cas de timeout)\n\t\t$nb_deja_la = sql_countsel($table);\n\t\t$inserts = array_slice($inserts, $nb_deja_la);\n\t\t$nb_a_inserer = count($inserts);\n\t\t// on decoupe en petit bout (pour reprise sur timeout)\n\t\t$inserts = array_chunk($inserts, 100);\n\t\tforeach ($inserts as $i) {\n\t\t\tsql_insertq_multi($table, $i);\n\t\t\t$nb_inseres += count($i);\n\t\t\t// serie_alter() relancera la fonction jusqu'a ce que l'on sorte sans timeout.\n\t\t\tif (time() >= _TIME_OUT) {\n\t\t\t\t// on ecrit un gentil message pour suivre l'avancement.\n\t\t\t\techo \"<br />Insertion dans $table relanc&eacute;e : \";\n\t\t\t\techo \"<br />- $nb_deja_la &eacute;taient d&eacute;j&agrave; l&agrave;\";\n\t\t\t\techo \"<br />- $nb_inseres ont &eacute;t&eacute; ins&eacute;r&eacute;s.\";\n\t\t\t\t$a_faire = $nb_a_inserer - $nb_inseres;\n\t\t\t\techo \"<br />- $a_faire &agrave; faire.\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}", "public function actionImportar()\n\t{\n\t\t// renders the view file 'protected/views/site/index.php'\n\t\t// using the default layout 'protected/views/layouts/main.php'\t\t\n\t\t$model = new ImportarForm();\n\t\t$reg = 0;\n\t\t$archivos = CUploadedFile::getInstancesByName('archivo');\n\t\tif ((count($archivos) > 0) or (isset($_POST[\"ImportarForm\"][\"archivos_subidos\"]) and $_POST[\"ImportarForm\"][\"archivos_subidos\"] == 1)) {\n\t\t\t$model->attributes = $_POST[\"archivo\"];\n\t\t\tif (count($archivos) > 0) {\n\t\t\t\t$model->archivo = $archivos[0];\n\t\t\t} else {\n\t\t\t\t$model->archivo = null;\n\t\t\t}\n\t\t\tif ($model->validate()) {\n\t\t\t\t// aqui entra CFileValidator\n\t\t\t\t//$filename = sys_get_temp_dir().'/'.$model->archivo->getName();\n\t\t\t\t/*if (isset($_POST[\"ImportarForm\"][\"archivos_subidos\"]) and $_POST[\"ImportarForm\"][\"archivos_subidos\"] == 1) {\n\t\t\t\t\t//recupero los archivos que esten en la carpeta temporal y los importo\n\t\t\t\t\t$archivos_generados = $this->showFiles();\n\t\t\t\t} else {\n\t\t\t\t\t$model->archivo->saveAs($model->archivo->getName());\n\t\t\t\t\t// trunco el archivo en mas chicos para agilizar la carga\n\t\t\t\t\t$archivos_generados = $this->truncarArchivo($model->archivo->getName());\n\t\t\t\t\tunlink($model->archivo->getName());// borro el archivo original \n\t\t\t\t}*/\n\t\t\t\t$model->archivo->saveAs($model->archivo->getName());\n\t\t\t\t//$xmlStr = file_get_contents($model->archivo->getName());\n\t\t\t\t//$xml = simpleXML_load_file($model->archivo->getName());\t\n\t\t\t\t$texto = file_get_contents($model->archivo->getName());\n\t\t\t\t$xml = new SimpleXMLElement($texto);\n\n\t\t\t\t//$xml = new SimpleXMLElement(file_get_contents($model->archivo->getName()));\n\t\t\t\tif ($xml === FALSE) {\n\t\t\t\t\tYii::log(\"Error importar análisis - No se pudo abrir\", CLogger::LEVEL_WARNING, __METHOD__);\n\t\t\t\t} else {\n\t\t\t\t\t$errores = array();\n\t\t\t\t\t/*AnalisisController::normalizeSimpleXML($xml, $result);*/\t\t\t\t\t\n\t\t\t\t\t$campo_conf='conf_import'.$_POST['config'];\t\n\t\t\t\t\t// arreglos con los cod dep de la conf de corredor, a futuro pasar a otra funcion\n\t\t\t\t\t$codigos_peso_hectlitrico \t= [1=>1,2=>null,3=>null];\n\t\t\t\t\t$codigos_conte_proteico \t= [1=>27,2=>null,3=>null];\n\n\n\t\t\t\t\tforeach ($xml->children() as $solicitud) {\n\t\t\t\t\t\t$contador = 0;\n\t\t\t\t\t\t$cartaP = (string) $solicitud->CamionVagon->Item['NumeroDeCartaDePorte'];\t\t\t\t\t\t\n\t\t\t\t\t\t$codProducto=(string) $solicitud->Matriz['Codigo'];\n\t\t\t\t\t\t// Recupero el producto por el cod dependiendo la conf seleccionada\n\t\t\t\t\t\t$prod = Producto::model()->find($campo_conf.'='.$codProducto);\n\t\t\t\t\t\t$prodDesc=(string) $solicitud->Matriz['Descripcion'];\n\t\t\t\t\t\tif(!$prod){\n\t\t\t\t\t\t\t// no se encontro el producto\n\t\t\t\t\t\t\tYii::log(\"Error importar análisis - No se encontro el producto \".$prodDesc, CLogger::LEVEL_WARNING, __METHOD__);\n\t\t\t\t\t\t\texit();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//<Matriz Codigo=\"2\" Descripcion=\"MAÍZ\" />\n\t\t\t\t\t\t//defino dos variables logicas para indicar si el el caso especial Peso Hecto y su valor es mayor igual a 75 y otra para ver si es Conte Pro\n\t\t\t\t\t\t$caso_peso_hect = false;\n\t\t\t\t\t\t$cont_proteico = 0;// guardo el id para luego actualizarlo\n\t\t\t\t\t\t// si no tiene EnsayoTecnica se toma, sino se ignora\n\t\t\t\t\t\tforeach ($solicitud->EnsayoTecnica as $ensayoTec) {\t\n\t\t\t\t\t\t\tif($contador == 0 ){\n\t\t\t\t\t\t\t\tprint_r('<br/>');\n\t\t\t\t\t\t\t\tprint_r('Prod: '.$codProducto.' - '.$prodDesc);\t\n\t\t\t\t\t\t\t\tprint_r('<br/>');\n\t\t\t\t\t\t\t\tprint_r('CP:'.$cartaP);\n\t\t\t\t\t\t\t\tprint_r('<br/>');\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t\t\t$contador++;\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$codRubro = (string) $ensayoTec->Ensayo['Codigo'];\n\t\t\t\t\t\t\t// Recupero el rubro por el cod dependiendo la conf seleccionada\n\t\t\t\t\t\t\t$rubro = Rubro::model()->find($campo_conf.'='.$codRubro);\n\t\t\t\t\t\t\t$valorRubro = (string) $ensayoTec->ResultadosYComponentes->ResultadoComponente->ResultadoDelEnsayo['Alfabetico'];\n\t\t\t\t\t\t\t// Recupero calculo valor\n\t\t\t\t\t\t\t$calc_valor = RubroCalculoValor::model()->find('producto='.$prod->id.' AND rubro='.$rubro.' AND valor_desde>'.$valorRubro.' AND '.$valorRubro.'=<valor_hasta');\n\t\t\t\t\t\t\tif(!$calc_valor){\n\t\t\t\t\t\t\t\t// VER que hacer si no se encontro el rubro_calculo_valor\n\t\t\t\t\t\t\t\tYii::log(\"Error importar análisis - No se encontro el rubro_calc_valor \".$prod->id.' - '.$rubro.' - '.$valorRubro, CLogger::LEVEL_WARNING, __METHOD__);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t// guardo en una variable el valor de castiga_bonifica si entra por el caso especial la sobreescribo con cero\n\t\t\t\t\t\t\t\t$mult_castiga_bonifica = $calc_valor->castiga_bonifica;\n\n\t\t\t\t\t\t\t\tif($codigos_peso_hectlitrico[$_POST['config']]==$rubro && $valorRubro >= 75){\n\t\t\t\t\t\t\t\t\t// prendo el flag\n\t\t\t\t\t\t\t\t\t$caso_peso_hect = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//Cond especial si el Conte. Prot es mayor a 11 y el Peso Hecto es mayor o igual a 75, toma castiga_bonifica de la tabla, si es menor a 75 castiga_bonifica es cero\n\t\t\t\t\t\t\t\tif($codigos_conte_proteico[$_POST['config']]==$rubro && $valorRubro > 11){\n\t\t\t\t\t\t\t\t\t// Estoy analizando Contenido Proteico y el valor es mayor a 11\n\t\t\t\t\t\t\t\t\tif($caso_peso_hect){\n\t\t\t\t\t\t\t\t\t\t// es el caso especial que el peso hect es mayor o igual a 75 \n\t\t\t\t\t\t\t\t\t\t$mult_castiga_bonifica=0; //NO BONIFICA\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t\t\t$diferencia = ($calc_valor->diferencia_valor_hasta == 1)? $calc_valor->valor_hasta - $valorRubro : 0; // consultar\n\t\t\t\t\t\t\t\t$calculo = $diferencia * $mult_castiga_bonifica;\n\t\t\t\t\t\t\t\t$adiciona = $calculo + $calc_valor->adicionar_a_castiga_bonifica;\n\t\t\t\t\t\t\t\t$adiciona = $calc_valor->bonifica==1 ? $adiciona : $adiciona * -1;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// grabo el analisis\n\t\t\t\t\t\t\t\t$analisis = new Analisis;\n\t\t\t\t\t\t\t\t$analisis->rubro = $rubro;\n\t\t\t\t\t\t\t\t$analisis->carta_porte = $cartaP;\n\t\t\t\t\t\t\t\t$analisis->producto = $prod->id;\n\t\t\t\t\t\t\t\t$analisis->bonifica_rebaja = $adiciona;\n\t\t\t\t\t\t\t\t$analisis->valor = $valorRubro;\n\t\t\t\t\t\t\t\t$analisis->usuario = Yii::app()->user->id;\n\t\t\t\t\t\t\t\tif(!$analisis->save()){\n\t\t\t\t\t\t\t\t\t$errores[$cartaP] =$analisis->getErrors();\n\t\t\t\t\t\t\t\t\tYii::log(\"Error importar análisis - No pudo insertar \".$analisis->getErrors(), CLogger::LEVEL_WARNING, __METHOD__);\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\tif($codigos_conte_proteico[$_POST['config']]==$rubro && !$caso_peso_hect){\n\t\t\t\t\t\t\t\t\t\t// Estoy analizando Contenido Proteico y aun no analice peso hecto, por lo que guardo el ID\n\t\t\t\t\t\t\t\t\t\t$cont_proteico = $analisis->id;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t$reg++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//print_r('CP:'.$cartaP.' Cod:'.$codRubro.' Valor:'.$valorRubro);\n\t\t\t\t\t\t\t//print_r('<br/>');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($contador >0 ){\t\n\t\t\t\t\t\t\t// reviso el caso especial \n\t\t\t\t\t\t\t// si llegue a esta punto y las dos variables estan en true y distinta de cero es pq analice primero Conte Proteico y luego Peso Hecto y además este último su valor es mayor o igual a 75\n\t\t\t\t\t\t\tif($caso_peso_hect && $cont_proteico!=0){\n\t\t\t\t\t\t\t\t// recalculo\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// busco si hay un rubro \"Peso Hectolitrico\" para esta carta de porte de ser así recalculo el rubro Contenido proteico. Si el valor de Peso Hect es menor a 75 el campo bonifica es cero\n\t\t\t\t\t\t\t// para la configuración 1 el cód también es 1\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//$_POST['config']\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (count($errores) > 0) {\n\t\t\t\t\t\t\t$msj = '';\n\t\t\t\t\t\t\t//print_r($errores); exit();\n\t\t\t\t\t\t\tforeach ($errores as $cp => $err) {\n\t\t\t\t\t\t\t\tforeach ($err as $attr => $msj_err) {\n\t\t\t\t\t\t\t\t\t$msj .= 'CP: ' . $cp . ' Campo: ' . $attr . '-' . $msj_err[0] . ' </br>';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tYii::app()->user->setFlash('danger', \"Error/es </br>\" . $msj);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tYii::app()->user->setFlash('success', \"Se importaron \" . $reg . \" registros nuevos.\");\t\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t$this->render('importar', array('model' => $model));\n\t}", "public function importar_entradas_post(Request $request){\n\n //datos comunes de las vistas\n $datos_vista = $this->cargar_datos();\n\n //recogeos el nombre del tipo de importacion\n $tipo_importacion = $request->tipo_importacion;\n\n //declaramos el metodo que vamos utilizar segun el tipo de importacion\n $metodo = 'cargar_archivo_'.$tipo_importacion;\n\n //recogemos el array de entradas que nos devuelve el metodo declarado\n $array_entradas = $this->$metodo();\n\n //guardamos las nuevas entradas en la base de datos\n $guardar_entradas_importadas = $this->guardar_entradas_importadas($array_entradas);\n\n //definimos el paso en que nos encontramos\n $datos_vista['paso'] = 'resumen-importar-entradas';\n\n //definimos el numero de las nuevas entradas\n $datos_vista['num_entradas'] = count($array_entradas);\n\n return return_vistas('blogs.importar-entradas', $datos_vista);\n }", "function importArticles() {\n\t\t\t\n\t\t\t//Qui dovrei importare il file dall'FTP alla mia cartella uploads\n\t\t\t\n\t\t\t//Assumo che il file sia presente\n\t\t\t$importPath = DM_APP_PATH . DS . 'uploads' . DS . 'ANAGRAFICA.TXT';\n\t\t\t\n\t\t\trequire_once(DM_APP_PATH . DS . 'helpers' . DS . 'articlehelper.php');\n\t\t\t$result = FHArticleHelper::importArticlesFromFile($importPath, false);\n\t\t\t\n\t\t\tprint_r($result);\n\t\t\t\n\t\t\t//Deve scaricare lo zip e scompattarlo in /media/articles\n\t\t\t\n\t\t\texit;\n\t\t\t\n\t\t}", "public function actionImportacao()\n {\n // model do import file\n $model = new \\yii\\base\\DynamicModel(['fileImport' => 'File Import']);\n $model->addRule(['fileImport'],'required');\n $model->addRule(['fileImport'], 'file', ['extensions' => 'ods,xls,xlsx']);\n\n if ($post = \\Yii::$app->request->post()) {\n try { \n $transaction = \\Yii::$app->db->beginTransaction();\n \n // pega a instancia do arquivo\n $model->fileImport = UploadedFile::getInstance($model, 'fileImport');\n \n if ($model->fileImport && $model->validate()) {\n // importa o arquivo excel para array\n $excelFile = Excel::widget([\n 'mode' => 'import',\n 'fileName' => $model->fileImport->tempName,\n 'setFirstRecordAsKeys' => true,\n 'setIndexSheetByName' => false,\n ]); \n \n // valida a planilha\n if (!$excelFile || !is_array($excelFile)) {\n throw new \\Exception('Houve um erro ao importar o arquivo.'); \n }\n \n // varre as planilhas\n foreach ($excelFile as $key => $workSheet) {\n if (is_array($workSheet) && count($workSheet) > 0) {\n // seta variaveis de controle\n $posicao = 1;\n $contratoTemp = null;\n \n // varre cada linha da planilha\n foreach ($workSheet as $key => $data) {\n // posicao da linha\n ++$posicao;\n \n // transforma o array em objeto e valida a linha\n // se retornar false (ou null) pula para a proxima linha\n if (!$data = $this->synthesizeWorksheet($data)) {\n continue;\n }\n \n // busca um cliente e verifica se é o mesmo que esta sendo cadastrado\n if ($cliente = Cliente::findOne(['documento' => $data->documento])) {\n if (strtoupper($cliente->nome) != strtoupper($data->nome)) {\n throw new \\Exception('Não é possível cadastrar um cliente diferente usando o mesmo CPF/CNPJ.'); \n }\n \n // reseta o contrato temporario\n if ($contratoTemp && $contratoTemp->id_cliente != $cliente->id) {\n $contratoTemp = null;\n }\n } else { \n $cliente = new Cliente();\n $cliente->documento = $data->documento;\n \n // seta o tipo do cliente\n if (strlen($data->documento) == 11) {\n $cliente->tipo = Cliente::TIPO_FISICO;\n } else {\n $cliente->tipo = Cliente::TIPO_JURIDICO;\n }\n \n // seta o nome\n $cliente->nome = $data->nome;\n $cliente->nome_pai = $data->nome_pai;\n $cliente->nome_mae = $data->nome_mae;\n \n // salva a model\n if (!$cliente->save()) {\n throw new \\Exception(Helper::renderErrors($cliente->getErrors()));\n }\n \n // reseta o contrato temporario\n $contratoTemp = null;\n }\n \n // seta o id do cliente\n $id_cliente = $cliente->id ? $cliente->id : $cliente->getPrimaryKey();\n \n // seta os dados basicos e o contrato do cliente\n // \n // se ja cadastrou um contrato para este cliente\n // entao os dados basicos do cliente ja foram adicionados\n if (!$contrato = $contratoTemp) { \n // adiciona os telefones do cliente\n $cliente->addTelefone($data->tel_residencial, Telefone::TIPO_RESIDENCIAL, $id_cliente);\n $cliente->addTelefone($data->tel_comercial, Telefone::TIPO_COMERCIAL, $id_cliente);\n $cliente->addTelefone($data->tel_celular, Telefone::TIPO_MOVEL, $id_cliente);\n \n // adiciona o email\n if (!empty($data->email)) {\n $email = new Email(); \n $email->id_cliente = $id_cliente;\n $email->email = $data->email;\n $email->ativo = Email::SIM;\n \n // salva a model\n if (!$email->save()) {\n throw new \\Exception(Helper::renderErrors($email->getErrors()));\n }\n }\n \n // valida e seta o endereco\n if (!empty($data->logradouro) && !empty($data->cep)) {\n if (!Endereco::findEndereco($id_cliente, $data->logradouro, $data->numero, $data->cep)) {\n $endereco = new Endereco();\n $endereco->id_cliente = $id_cliente;\n $endereco->logradouro = $data->logradouro;\n $endereco->numero = (string) $data->numero;\n $endereco->cep = $data->cep;\n $endereco->bairro = $data->bairro;\n \n // busca o estado\n if (!$estado = Estado::findOne(['sigla' => $data->estado])) {\n throw new \\Exception(\"Não foi possível encontrar um estado com a sigla: \\\"{$data->estado}\\\"\");\n }\n // busca a cidade\n if (!$cidade = $estado->findCidade($data->cidade)) {\n throw new \\Exception(\"Não foi possível encontrar uma cidade com o nome: \\\"{$data->cidade}\\\"\");\n }\n \n // seta a cidade e o estado\n $endereco->cidade_id = $cidade->id;\n $endereco->estado_id = $estado->id;\n \n // salva a model\n if (!$endereco->save()) {\n throw new \\Exception(Helper::renderErrors($endereco->getErrors()));\n }\n }\n }\n \n // cria um novo contrato \n $contrato = new Contrato();\n $contrato->id_cliente = $id_cliente;\n $contrato->id_carteira = $post['carteira'];\n $contrato->data_cadastro = $data->data_contrato;\n $contrato->data_negociacao = $data->data_contrato;\n $contrato->observacao = $data->obs_contrato;\n $contrato->tipo = Contrato::getTipoByName($data->produto);\n $contrato->num_contrato = $data->num_contrato;\n $contrato->num_plano = (String) $data->plano;\n\n // seta o vencimento do contrato\n if (empty($contrato->data_vencimento)) {\n $contrato->data_vencimento = $data->data_vencimento;\n }\n }\n\n // soma o valor do contrato\n $contrato->valor = $contrato->valor + $data->valor;\n \n // salva a model\n if (!$contrato->save()) {\n throw new \\Exception(Helper::renderErrors($contrato->getErrors()));\n }\n \n // se o contrato tiver mais de 1 parcela, \n // salva o contrato temporariamente em uma variavel\n if ($data->parcela > 1) {\n $contratoTemp = $contrato;\n }\n\n // valida e seta a parcela\n if ($data->parcela && $data->data_vencimento && $data->valor) {\n $parcela = new ContratoParcela();\n $parcela->id_contrato = $contrato->id ? $contrato->id : $contrato->getPrimaryKey();\n $parcela->num_parcela = $data->obs_parcela ? $data->obs_parcela : 1;\n $parcela->data_vencimento = $data->data_vencimento;\n $parcela->valor = $data->valor;\n \n // salva a model\n if (!$parcela->save()) {\n throw new \\Exception(Helper::renderErrors($parcela->getErrors()));\n }\n }\n }\n }\n } \n }\n \n $transaction->commit();\n \\Yii::$app->session->setFlash('success', '<i class=\"fa fa-check\"></i>&nbsp; O arquivo foi importado com sucesso.');\n } catch (\\Exception $e) {\n $transaction->rollBack();\n \\Yii::$app->session->setFlash('danger', \"<i class='fa fa-exclamation-triangle'></i>&nbsp; Houve um erro na linha \\\"{$posicao}\\\": {$e->getMessage()}\");\n }\n }\n \n // importacao\n return $this->render('importacao', [\n 'model' => $model,\n 'carteiraes' => ArrayHelper::map(Carteira::find()->all(), 'id', 'nome'),\n ]);\n }", "public function importar_archivo(Request $request){\n\n //datos comunes de las vistas\n $datos_vista = $this->cargar_datos();\n \n //obtenemos el array de imagenes que define el tipo de importacion\n $arr_imagenes_importar = $this->imagenes_importar_entradas();\n\n //si el request que recibimos no se haya entre el array anterior, volvemos a la vista inicial\n if(!isset($arr_imagenes_importar[$request->tipo])){\n return redirect()->route('tipo-importacion');\n }\n\n //recogemos el tipo de archivo\n $datos_vista['tipo-importacion'] = $request->tipo;\n\n //definimos el paso en que nos encontramos\n $datos_vista['paso'] = 'importar-archivo';\n\n return return_vistas('blogs.importar-entradas', $datos_vista);\n\n }", "public function importar(){\n\n\t\t//Cargar librería upload con los siguientes parámetros\n\t\t$config['upload_path'] = './uploads/';\n\t\t$config['allowed_types'] = 'csv';\n\t\t$config['max_size'] = '1000000000';\n\t\t$this->load->library('upload', $config);\n\t\t$this->upload->initialize($config);\t\n\n\t\t//Cargar modelo atenciones\n\t\t$this->load->model('atenciones');\n\t\t\n\n\t\t\n\t\t$filename = $_FILES['archivo_csv']['name'];\t\n\t\t// En el caso que se suba un archivo repetido se elimina el anterior. \n\t\tif (!empty($filename)) {\n\t\t\tif (file_exists('./uploads/'.$filename)){\n\t\t\t\tunlink('./uploads/'.$filename);\n\t\t\t}\t\n\t\t}\n\t\t\t\n\t\t// Se sube el archivo CSV\n\t\t if (!$this->upload->do_upload('archivo_csv'))\n {\n \t$error = array('error' => $this->upload->display_errors());\n //$this->load->view('debug', $error);\n //var_dump($error);\n }\n\n else{\n\n \t// Se eliminan todos los registros anteroriores de la tabla atenciones.\n \t$this->atenciones->delete_all_atenciones();\n\n \t// Se lee el archivo subido y se agregan a la base de datos.\n \t$handle = fopen('./uploads/'.$filename, \"r\");\t\n \t\n\n \t//Variables para controlar cantidad de datos que van al batch para insertar.\n \t$data_batch = array();\n \t$limitador_batch = 100000;\n\n\n \t// Se lee cada registro del archivo CSV.\n\n \t// Se agrega esta linea para leer \n \t$flag_first = true;\n \twhile (($data = fgetcsv($handle, 1000, \";\")) !== FALSE)\n {\n \tif ($flag_first){\n \t\t$flag_first = false;\n \t\tcontinue;\n \t}\n\n \t// code por si se desea agregar los registros por medio de batchs---\n\t\t array_push($data_batch,array(\n\t\t\t\t\t'id' => $data[0],\n\t\t\t\t\t'fecha' => $data[1],\n\t\t\t\t\t'id_forma_ingreso' => $data[2],\n\t\t\t\t\t'id_contacto_crm' => $data[3],\n\t\t\t\t\t'id_coordinadora_crm' => $data[4],\n\t\t\t\t\t'id_producto_agrupador' => $data[5],\n\t\t\t\t\t'id_oficina_comercial_crm' => $data[6],\n\t\t\t\t\t'deleted' => $data[7],\n\t\t\t\t\t));\n\n\n\t\t // Se agrega este limitador ya que agregar todos los registros en un lote genera desborde de memoria permitida en php. \n if (count($data_batch) > $limitador_batch){\n \t$this->atenciones->insert_atenciones_batch($data_batch);\n \t\t$data_batch = array();\n \t}\n\n\n\n \t//code por si se desea insertar los registros unitariamente----\n\n \t// //insert_atenciones($id,$fecha,$id_forma_ingreso,$id_contacto_crm,$id_coordinadora_crm,$id_producto_agrupador,$id_oficina_comercial_crm,$deleted)\n //$this->atenciones->insertar_atenciones($data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6],$data[7]);\n\n\n\n\n }\n\n if (count($data_batch) > 0){\n \t$this->atenciones->insert_atenciones_batch($data_batch);\n \t\t$data_batch = array();\n }\n }\n\n\t\t$data['cantidad_datos'] = $this->atenciones->get_all_rows();\t\n\t\t$this->load->view('inicio',$data);\n\t}", "public function importar_linha( $row, $num ) {\n $this->load->library( 'validation' );\n $linha = lower_case_keys( $row );\n \n // percorre todos os campos\n foreach( $linha as $chave => $coluna ) {\n $linha[$chave] = in_cell( $linha[$chave] ) ? $linha[$chave] : null;\n }\n\n // pega as entidades relacionaveis\n $linha['CodCategoria'] = $this->verificaEntidade( 'CategoriasFinder', 'nome', $linha['categoria'], 'Categorias', 'Produtos', $num, 'CodCategoria', 'I' );\n if ( !in_cell( $linha['CodCategoria'] ) ) {\n $linha['CodCategoria'] = $this->verificaEntidade( 'CategoriasFinder', 'byRefCode', $linha['categoria'], 'Categorias', 'Produtos', $num, 'CodCategoria', 'I' );\n }\n if ( !in_cell( $linha['CodCategoria'] ) ) {\n $this->import->insertLine( $row, 'NENHUMA CATEGORIA INFORMADA' );\n return;\n }\n\n // Verifica o nome\n if ( !in_cell( $linha['nome'] ) ) {\n $this->import->insertLine( $row, 'NOME E OBRIGATORIO' );\n return;\n }\n\n // Verifica o nome\n if ( !in_cell( $linha['pontos'] ) ) {\n $this->import->insertLine( $row, 'PONTOS E OBRIGATORIO' );\n return;\n }\n\n // Verifica o nome\n if ( !is_numeric( $linha['pontos'] ) ) {\n $this->import->insertLine( $row, 'PONTOS PRECISA SER NUMERICO' );\n return;\n }\n\n // Verifica o nome\n if ( !in_cell( $linha['basiccode'] ) ) {\n $this->import->insertLine( $row, 'BASICCODE E OBRIGATORIO' );\n return;\n }\n\n // tenta carregar a loja pelo nome\n $produto = $this->ProdutosFinder->clean()->basicCode( $linha['basiccode'] )->get( true );\n\n // verifica se carregou\n if ( !$produto ) $produto = $this->ProdutosFinder->getProduto();\n\n // preenche os dados\n $produto->setBasicCode( $linha['basiccode'] );\n $produto->setNome( $linha['nome'] );\n $produto->setCategoria( $linha['CodCategoria'] );\n $produto->setPontos( $linha['pontos'] );\n $produto->setDescricao( null );\n $produto->setVideo( null );\n $produto->setFoto( 'sem-foto.jpg' );\n\n // Tenta salvar o produto\n if ( !$produto->save() ) {\n $this->import->insertLine( $row, 'NENHUM ERRO IDENTIFICADO' );\n return;\n }\n }", "public function import();", "public function import();", "public function importAction()\n {\n $_UP['pasta'] = './public_html/csv/';\n\n // Tamanho máximo do arquivo (em Bytes)\n $_UP['tamanho'] = 1024 * 1024 * 2; // 2Mb\n\n // Array com as extensões permitidas\n $_UP['extensoes'] = array('csv');\n\n // Array com os tipos de erros de upload do PHP\n $_UP['erros'][0] = 'Não houve erro';\n $_UP['erros'][1] = 'O arquivo no upload é maior do que o limite do PHP';\n $_UP['erros'][2] = 'O arquivo ultrapassa o limite de tamanho especifiado no HTML';\n $_UP['erros'][3] = 'O upload do arquivo foi feito parcialmente';\n $_UP['erros'][4] = 'Não foi feito o upload do arquivo';\n\n\n // Verifica se houve algum erro com o upload. Se sim, exibe a mensagem do erro\n if ($_FILES['arquivo']['error'] != 0){\n die(\"Não foi possível fazer o upload, erro:<br />\" . $_UP['erros'][$_FILES['arquivo']['error']]);\n exit; // Para a execução do script\n }\n // Caso script chegue a esse ponto, não houve erro com o upload e o PHP pode continuar\n\n // Faz a verificação da extensão do arquivo\n $extensao = strtolower(end(explode('.', $_FILES['arquivo']['name'])));\n if (array_search($extensao, $_UP['extensoes']) === false) {\n echo \"Por favor, envie arquivo com a seguinte extensões: csv\";\n }\n // Faz a verificação do tamanho do arquivo\n else if ($_UP['tamanho'] < $_FILES['arquivo']['size']){\n echo \"O arquivo enviado é muito grande, envie arquivos de até 2Mb.\";\n }\n\n // O arquivo passou em todas as verificações, hora de tentar movê-lo para a pasta\n else {\n //Modifica o nome do arquivo adicionando data e colocando uma id Unica\n $_FILES['arquivo']['name'];\n $data=date(\"dmY\");\n $resultNome = uniqid($_FILES['name']);\n $nome_final =$data.\"#\".$resultNome.\".csv\";\n\n // Depois verifica se é possível mover o arquivo para a pasta escolhida\n if (move_uploaded_file($_FILES['arquivo']['tmp_name'], $_UP['pasta'] . $nome_final)){\n\n //conecta ao banco de dados\n $con = mysql_connect('localhost','root','Linux1009');//padrao localhost e mysql\n if(!$con)\n {\n die('Erro de conexão:'.mysql_error());\n }\n mysql_select_db/*Nome do banco ->*/(\"paxvila_pax\") or die('Erro de conexão:'.mysql_error()) ;\n\n // nome do arquivo\n $arquivo = \"./public_html/csv/\".$nome_final;\n\n // ponteiro para o arquivo\n $fp = fopen($arquivo, \"r\");\n\n //processa os dados do arquivo\n $contador = 0;\n\n while(($dados = fgetcsv($fp, 0, \";\")) !== FALSE)\n {\n //var_dump($dados);die();\n $quant_campos = count($dados);\n if($contador == 0)\n {\n }else{\n for($i = 0; $i < 1; $i++)\n {\n $result = mysql_query(\"SELECT * FROM pax_mensalidade WHERE id = $dados[0]\");\n if(!$result) {\n die(\"Database query failed: \" . mysql_error());\n }\n while ($row = mysql_fetch_array($result)) {\n $diferenca = (double)$dados[1] - (double)$row[\"valor_mensalidade\"];\n $dataPag = date(\"Y-m-d\");\n mysql_query(\"UPDATE pax_mensalidade SET data_pagamento = '$dataPag',paga = '1',valor_pago = '$dados[1]',\n diferenca = '$diferenca' WHERE pax_mensalidade.id = $dados[0];\");\n }\n\n\n //echo $query;\n }\n\n }\n $contador++;\n }\n\n fclose($fp);\n mysql_close($con);\n // Redireciona para a index do Controller\n return $this->redirect()\n ->toRoute($this->route, array('controller' => $this->controller,));\n } else {\n\n // Não foi possível fazer o upload, provavelmente a pasta está incorreta\n echo \"Não foi possível enviar o arquivo, tente novamente\";\n }\n }\n return new ViewModel();\n }", "private function readImportFile()\n\t{\n\n\t\t// Datei einlesen\n\t\t$preData = file($this->coreGlobal['curFilePath']);\n\n\t\t$myNewData = array();\n\t\t$myData = array();\n\n\t\t// Array aufbereiten\n\t\tforeach($preData as $newLine)\n\t\t\t$myNewData[][0] = $newLine;\n\n\t\t$Data = $myNewData;\n\n\n\t\tforeach($Data as $index => $row) {\n\n\t\t\t// Centron Buchungsdaten?\n\t\t\t// TODO ... Die Buchungsdatei auf Tab oder Semikolon prüfen... aktuell müsste ich manuell hin/her wechseln.\n\t\t\tif ($this->coreGlobal['curSourceTypeID'] == '2') {\n\t\t\t\t// $eachValueArray = str_getcsv($row[0], \"\\t\");\n\t\t\t\t$eachValueArray = str_getcsv($row[0], \";\");\n\t\t\t}\n\n\t\t\telse\n\t\t\t\t$eachValueArray = str_getcsv($row[0], \";\");\n\n\n\t\t\t$myData[$index] = $eachValueArray;\n\n\t\t}\n\n\t\t// Speichere csv - Daten zur weiteren Verarbeitung in der globalen - Klassen - Variable\n\t\t$this->coreGlobal['ImportValue'] = $myData;\n\n\t\treturn true;\n\n\t}", "public function import() {\r\n if(isset($_FILES['excel'])){\r\n $import = $_FILES;\r\n $model = new Model_Salons();\r\n if($model->importEXCEL($import)) {\r\n $this->setMsg('Import przebiegł prawidłowo', 'success');\r\n } else {\r\n $this->setMsg('Aktualizacja bazy się nie powiodła', 'danger');\r\n }\r\n } else {\r\n $this->setMsg('Nie załączyłeś pliku excel', 'danger');\r\n }\r\n $this->redirect('?c=salons');\r\n }", "function importar_pa($array_hoja)\n {\n $no_importados = array();\n $fila = 2; //Inicia en la fila 2 de la hoja de cálculo\n \n //Predeterminados registro nuevo\n $arr_row['tipo_id'] = 121;\n $arr_row['referente_2_id'] = 1; //Pública, agregada por ELE\n\n $this->load->model('Post_model');\n \n foreach ( $array_hoja as $array_fila )\n {\n //Identificar valores\n $tema_id = $this->Pcrn->campo('tema', \"cod_tema = '{$array_fila[0]}'\", 'id');\n \n //Complementar registro\n $arr_row['referente_1_id'] = $tema_id;\n $arr_row['contenido'] = $array_fila[1];\n \n //Validar\n $condiciones = 0;\n if ( ! is_null($tema_id) ) { $condiciones++; } //Tiene tema identificado\n if ( strlen($arr_row['contenido']) > 0 ) { $condiciones++; } //Tiene contenido texto escrito\n \n //Si cumple las condiciones\n if ( $condiciones == 2 )\n { \n $this->Post_model->guardar_post('id = 0', $arr_row); //Condición imposible, siempre agrega\n } else {\n $no_importados[] = $fila;\n }\n \n $fila++; //Para siguiente fila\n }\n \n return $no_importados;\n }", "public function createImport();", "private function gerarArquivo() {\n\n $aContas = ArquivoConfiguracaoTCEAC::getInstancia()->getContaCorrente();\n\n if (empty($aContas)) {\n throw new Exception(\"Nenhuma conta corrente encontrada no arquivo de configuração.\");\n }\n\n /**\n * Busca os lançamentos\n */\n $sWhere = \" c02_instit in(\" . implode(',', $this->aInstituicoes) . \") \\n\";\n $sWhere .= \" and e81_cancelado is null \\n\";\n $sWhere .= \" and (empageconfche.e91_codcheque is null or empageconfche.e91_ativo is true) \\n\";\n $sWhere .= \" and c69_data between '{$this->oDataInicial->getDate()}' and '{$this->oDataFinal->getDate()}' \\n\";\n $oDaoConlancamval = new cl_conlancamval();\n $aQuerys = array(\"D\" => \"c69_debito\", \"C\" => \"c69_credito\");\n\n $aSqlLancamentos = '';\n\n foreach ($aQuerys as $sTipo => $sCampo) {\n\n $sCampos = \" contacorrentedetalhe.*,\";\n $sCampos .= \" c69_sequen, c69_codlan, c69_data, c69_valor, {$sCampo} as c69_conta, '{$sTipo}' as tipo, conlancaminstit.c02_instit, c75_numemp, \\n\";\n $sCampos .= \" conplano.c60_estrut, conplano.c60_identificadorfinanceiro, \\n\";\n $sCampos .= \" case when c115_sequencial is null then false else true end as estorno, \\n\";\n $sCampos .= \" conlancamslip.c84_conlancam is not null as slip, conlancamslip.c84_slip, empageconfche.e91_cheque, \\n\";\n $sCampos .= \" placaixarec.k81_seqpla is not null as planilha, placaixarec.k81_operbanco, placaixarec.k81_codpla, \\n\";\n $sCampos .= \" (select k12_numpre \\n\";\n $sCampos .= \" from cornump \\n\";\n $sCampos .= \" where cornump.k12_id = corrente.k12_id \\n\";\n $sCampos .= \" and cornump.k12_data = corrente.k12_data \\n\";\n $sCampos .= \" and cornump.k12_autent = corrente.k12_autent limit 1) as numpre, \\n\";\n $sCampos .= \" coremp.k12_id is not null as ordempagamento, coremp.k12_cheque as cheque_ordem, coremp.k12_codord \\n\";\n $aSqlLancamentos [] = $oDaoConlancamval->sql_query_contacorrentedetalhe_tce($sCampos, $sTipo, '', $sWhere);\n }\n\n $sSqlLancamentos = implode(\" union all \", $aSqlLancamentos);\n $sSqlLancamentos .= \" order by c69_data, c69_sequen\";\n $rsLancamentos = $oDaoConlancamval->sql_record($sSqlLancamentos);\n\n if ($oDaoConlancamval->erro_status == '0') {\n throw new Exception(\"Erro ao buscar os dados dos lançamentos.\");\n }\n\n if (!pg_num_rows($rsLancamentos)) {\n throw new Exception(\"O Período informado não possui lançamentos contábeis.\");\n }\n\n $oXml = new DOMDocument( \"1.0\", \"utf-8\" );\n $oXml->formatOutput = true;\n $oTagLista = $oXml->createElement(\"lista\");\n\n /**\n * Percorre os lançamentos montando o XML\n */\n $aContasInvalidas = array();\n for ($iRow = 0; $iRow < pg_num_rows($rsLancamentos); $iRow++) {\n\n $oTagPartida = $oXml->createElement(\"partida\");\n\n $oLancamento = db_utils::fieldsMemory($rsLancamentos, $iRow);\n $oContaCorrenteDetalhe = new ContaCorrenteDetalhe();\n\n if (!empty($oLancamento->c19_orctiporec)) {\n $oContaCorrenteDetalhe->setRecurso(RecursoRepository::getRecursoPorCodigo($oLancamento->c19_orctiporec));\n }\n\n if (!empty($oLancamento->c19_estrutural)) {\n $oContaCorrenteDetalhe->setEstrutural($oLancamento->c19_estrutural);\n }\n\n if (!empty($oLancamento->c19_orcdotacao) && !empty($oLancamento->c19_orcdotacaoanousu)) {\n $oContaCorrenteDetalhe->setDotacao(DotacaoRepository::getDotacaoPorCodigoAno($oLancamento->c19_orcdotacao, $oLancamento->c19_orcdotacaoanousu));\n }\n\n if (!empty($oLancamento->c19_numemp)) {\n $oContaCorrenteDetalhe->setEmpenho(EmpenhoFinanceiroRepository::getEmpenhoFinanceiroPorNumero($oLancamento->c19_numemp));\n }\n\n if (!empty($oLancamento->c19_contabancaria)) {\n $oContaCorrenteDetalhe->setContaBancaria(new ContaBancaria($oLancamento->c19_contabancaria));\n }\n\n if (!empty($oLancamento->c19_acordo)) {\n $oContaCorrenteDetalhe->setAcordo(AcordoRepository::getByCodigo($oLancamento->c19_acordo));\n }\n\n if (!empty($oLancamento->c19_numcgm)) {\n $oContaCorrenteDetalhe->setCredor(CgmFactory::getInstanceByCgm($oLancamento->c19_numcgm));\n }\n\n $sPlanoConta = ArquivoConfiguracaoTCEAC::getInstancia()->getPlanoContaPorCodigo($oLancamento->c60_estrut);\n\n if (empty($sPlanoConta) || !preg_match(\"/^(\\d)(\\d)(\\d)(\\d)(\\d)(\\d{2})(\\d{2})$/\", $sPlanoConta)) {\n $aContasInvalidas[] = $oLancamento->c60_estrut;\n // throw new Exception(\"Código estrutural inválido para a conta {$oLancamento->c60_estrut}.\");\n }\n\n /**\n * Seta a contacontabil\n */\n $oTagCondigoContaContabil = $oXml->createElement(\"codigo\", preg_replace(\"/(\\d)(\\d)(\\d)(\\d)(\\d)(\\d{2})(\\d{2})/\", \"$1.$2.$3.$4.$5.$6.$7\", $sPlanoConta) );\n $oTagContaContabil = $oXml->createElement(\"contaContabil\");\n $oTagContaContabil->appendChild($oTagCondigoContaContabil);\n\n /**\n * Seta os dados da Conta Corrente\n */\n $lGerarContaCorrente = !empty($oLancamento->c19_sequencial);\n $sDadosContaCorrente = $this->getLinhaContaCorrente($oContaCorrenteDetalhe, $oLancamento);\n\n $iTipoContaCorrente = ArquivoConfiguracaoTCEAC::getInstancia()->getContaCorrentePorCodigo($oLancamento->c19_contacorrente);\n\n if ( !empty($sDadosContaCorrente) && !empty($iTipoContaCorrente) ) {\n\n switch ($iTipoContaCorrente) {\n\n case self::CONTA_CORRENTE_DOTACAO:\n $sDadosContaCorrente = str_pad($sDadosContaCorrente, 38, '0', STR_PAD_RIGHT);\n break;\n case self::CONTA_CORRENTE_DESPESA:\n $sDadosContaCorrente = str_pad($sDadosContaCorrente, 82, '0', STR_PAD_RIGHT);\n break;\n case self::CONTA_CORRENTE_MOVIMENTACAO_FINANCEIRA:\n\n $oContaPlano =\n ContaPlanoPCASPRepository::getContaPorReduzido(\n $oLancamento->c19_reduz,\n $oLancamento->c19_conplanoreduzanousu,\n InstituicaoRepository::getInstituicaoByCodigo($oLancamento->c02_instit)\n );\n\n $sRecurso = ArquivoConfiguracaoTCEAC::getInstancia()->getRecursoPorCodigo($oContaPlano->getRecurso());\n $sDadosContaCorrente .= str_pad($sRecurso, 3, '0', STR_PAD_LEFT);\n break;\n }\n }\n\n $oTagContaCorrente = $oXml->createElement(\"conteudoContaCorrente\", $sDadosContaCorrente);\n\n /**\n * Seta o Tipo de conta corrente\n */\n if ($lGerarContaCorrente) {\n\n $oTagNumeroTipoConta = $oXml->createElement(\"numero\", ArquivoConfiguracaoTCEAC::getInstancia()->getContaCorrentePorCodigo($oLancamento->c19_contacorrente));\n $oTagTipoConta = $oXml->createElement(\"tipoDeContaCorrente\");\n $oTagTipoConta->appendChild($oTagNumeroTipoConta);\n }\n\n $oTagNatureza = $oXml->createElement(\"natureza\", $oLancamento->tipo);\n\n $oTagIdentificadorFinanceiro = null;\n\n /**\n * Seta o Identificador Financeiro\n */\n if ( in_array($oLancamento->c60_identificadorfinanceiro, array(\"F\", \"P\"))) {\n $oTagIdentificadorFinanceiro = $oXml->createElement(\"indicadorSuperavitFinanceiro\", $oLancamento->c60_identificadorfinanceiro);\n }\n\n /**\n * Seta a Tag Lancamento\n */\n $oTagLancamento = $oXml->createElement(\"lancamento\");\n $oTagNumeroLancamento = $oXml->createElement(\"numero\", $oLancamento->c69_codlan);\n $oTagTipoLancamento = $oXml->createElement(\"tipoDeLancamento\", ($oLancamento->estorno == 't' ? \"ESTORNO\" : \"ORDINARIO\"));\n\n $oTagLancamento->appendChild($oTagNumeroLancamento);\n $oTagLancamento->appendChild($oTagTipoLancamento);\n\n /**\n * Seta o Valor\n */\n $oTagValor = $oXml->createElement(\"valor\", $oLancamento->c69_valor);\n\n /**\n * Monta o registro no xml\n */\n $oTagPartida->appendChild($oTagContaContabil);\n $oTagPartida->appendChild($oTagContaCorrente);\n\n if ($lGerarContaCorrente) {\n $oTagPartida->appendChild($oTagTipoConta);\n }\n\n $oTagPartida->appendChild($oTagNatureza);\n if (!empty($oTagIdentificadorFinanceiro)) {\n $oTagPartida->appendChild($oTagIdentificadorFinanceiro);\n }\n $oTagPartida->appendChild($oTagLancamento);\n $oTagPartida->appendChild($oTagValor);\n\n $oTagLista->appendChild( $oTagPartida );\n }\n\n if (!empty($aContasInvalidas)) {\n throw new Exception(\"Códigos de estrutural inválido para as contas: \\n \".implode(array_unique($aContasInvalidas), \",\\n\"));\n }\n\n $oXml->appendChild( $oTagLista );\n\n $this->validarXML($oXml, 'config/tce/AC/schema-partida.xsd');\n $this->sArquivo = $oXml->saveXML();\n }", "abstract public function import();", "public function copiaArquivosImportantes(){\n\t\t$copiador = new Copiador();\n\t\t$nomeDoSite = $this->software->getNome();\n\t\t\n\t\t\n\t\t\n\t\t$caminho_inicial = 'class/appado/TCriteria.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TCriteria.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\t\n\t\t$caminho_inicial = 'class/appado/TExpression.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TExpression.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t$caminho_inicial ='class/appado/TFilter.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TFilter.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\n\t\t$caminho_inicial = 'class/appado/TSqlInstruction.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TSqlInstruction.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\n\t\t$caminho_inicial = 'class/appado/TSqlInsert.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TSqlInsert.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\n\t\t$caminho_inicial = 'class/appado/TSqlSelect.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TSqlSelect.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\n\t}", "function import() {\n Configure::write('debug', 0);\n $id = $this->Avisosrepuesto->id;\n $this->set('avisosrepuesto', $this->Avisosrepuesto->find('first', array('contain' => array('Albaranescliente' => 'Cliente', 'Presupuestosproveedore' => 'Proveedore', 'Presupuestoscliente' => 'Cliente', 'ArticulosAvisosrepuesto' => 'Articulo', 'Cliente', 'Centrostrabajo', 'Maquina', 'Almacene', 'Estadosaviso'), 'conditions' => array('Avisosrepuesto.id' => $id))), 'estadosaviso');\n // echo \"id= \". $this->Avisosrepuesto->id . \"<br />\"; \n//Upload File\n if (isset($_POST['idAviso'])) {\n $id = $_POST['idAviso'];\n }\n if (isset($_POST['idAlmacene'])) {\n $idAlmacen = $_POST['idAlmacene'];\n }\n\n if (isset($_POST['submit'])) {\n\n if (is_uploaded_file($_FILES['filename']['tmp_name'])) {\n //echo \"<h1>\" . \"El fichero \" . $_FILES['filename']['name'] . \" uploaded successfully.\" . \"</h1>\";\n $resultadoUpload = \"El fichero <b>\" . $_FILES['filename']['name'] . \"</b> subido con éxito. <br />\";\n /* echo \"<h2>Displaying contents:</h2>\";\n readfile($_FILES['filename']['tmp_name']); */\n }\n //Import uploaded file to Database en modo Lectura\n $handle = fopen($_FILES['filename']['tmp_name'], \"r\");\n $cntRegistros = 0;\n $cntInsert = 0;\n $cntNoProcede = 0;\n $resultadoIncidencias = \"<ol>\";\n $flag = true; // para saltar la cabecera\n while (($data = fgetcsv($handle, 1000, \";\")) !== FALSE) {\n if ($flag) {\n $flag = false;\n continue;\n }\n $cntRegistros ++;\n // buscados el idArticulo por la referencia\n $consulta = sprintf(\"SELECT id, count(*) as total FROM articulos \n WHERE UPPER(ref) LIKE UPPER('%s') \n AND almacene_id = %s\", '%' . mysql_real_escape_string($data[0]) . '%', $idAlmacen);\n\n// Ejecutar la consulta\n $resultadoSQL = mysql_query($consulta);\n if (!$resultadoSQL) {\n $mensaje = 'Consulta no válida: ' . mysql_error() . '. Consulta completa: ' . $consulta;\n die($mensaje);\n }\n\n //$resultado .= $consulta . '<br />';\n // echo $consulta . ' id= ' . $dataSQL['id'] . ' total= ' . $dataSQL['total'] . '<br />';\n $dataSQL = mysql_fetch_assoc($resultadoSQL);\n //echo \"Registros con ref \" . $data[0] . \" coincide = \" . $dataSQL['total'] . '<br />';\n // Depende del resultado obtenido \n $articulo_id = $dataSQL['id'];\n\n switch ($dataSQL['total']) {\n case 0:\n $resultadoIncidencias .= sprintf(\"<li> Referencia = %s ,\"\n . \" <span style='color:red;font-weight:bold'> NO existe </span> como articulo en el Sistema.</li>\"\n , $data[0] );\n $cntNoProcede ++;\n break;\n case 1:\n $insertOrUpdate = \"INSERT INTO articulos_avisosrepuestos (avisosrepuesto_id, articulo_id, cantidad) \"\n . \"values('$id','$articulo_id', '$data[1]')\";\n $cntInsert ++;\n break;\n default :\n $resultadoIncidencias .= sprintf(\"<li> Referencia = %s, \"\n . \"<span style='color:red;font-weight:bold'>, Coincide más de un articulo </span> con esta referencia \"\n . '. Comprobar = %s </li>'\n , $data[0], $consulta);\n $cntNoProcede ++;\n } // switch \n\n if (strlen($insertOrUpdate) > 0) {\n $resultado2SQL = mysql_query($insertOrUpdate);\n if (!$resultado2SQL) {\n $mensaje = 'Consulta no válida: ' . mysql_error() . \"\\n\";\n $mensaje .= 'Consulta completa: ' . $insertOrUpdate;\n die($mensaje);\n }\n }\n $insertOrUpdate = \"\";\n } // While\n fclose($handle);\n\n $resultadoResumen = \" Total de registros analizados : \" . $cntRegistros . '<br />'\n . \" Articulos creados en el aviso : \" . $cntInsert . '<br />'\n . \" Registros NO procesados por incidencias : \" . $cntNoProcede;\n\n $this->set('resultadoUpload', isset($resultadoUpload) ? $resultadoUpload : \" \" );\n $this->set('resultadoResumen', isset($resultadoResumen) ? $resultadoResumen : \" \" );\n $this->set('resultado', (isset($resultadoIncidencias) ? $resultadoIncidencias : \" \" ) . \"</ol>\");\n $this->Session->setFlash(__('Importación finalizada con éxito .', true));\n } else {\n $this->set('resultadoResumen', \"\");\n $this->set('resultadoUpload', \"No hay fichero a subir\");\n }\n }", "public function ImportarDocumento($idproveedor='',$estatus,$tipo)\r\n {\r\n $sql=\"SELECT \r\n c.idcompra AS idcompraop ,c.idproveedor,c.cod_compra AS origenc ,c.estatus,pv.cod_proveedor,pv.desc_proveedor,\r\n pv.rif,c.idcondpago,pv.limite,cp.cod_condpago,cp.desc_condpago,cp.dias,c.tipo,c.numerod,c.totalh,\r\n DATE_FORMAT(c.fechareg,'%d/%m/%Y') AS fechareg, DATE_FORMAT(c.fechaven,'%d/%m/%Y') AS fechaven\r\n FROM tbcompra c\r\n INNER JOIN tbproveedor pv ON pv.idproveedor=c.idproveedor\r\n INNER JOIN tbcondpago cp ON cp.idcondpago =c.idcondpago\r\n AND \r\n ('$idproveedor'='' OR c.idproveedor='$idproveedor')\r\n AND (c.tipo='$tipo') \r\n AND ( ('$estatus'='todos' AND c.estatus<>'Anulado')\r\n OR('$estatus'='sinp' AND c.estatus<>'Anulado' AND c.estatus<>'Procesado'))\";\r\n return ejecutarConsulta($sql);\r\n }", "public function doimport() {\n\t\t$config['upload_path'] = './uploads/';\n\t\t$config['allowed_types'] = 'xls|xlsx';\n\t\t$this->load->library('upload', $config);\n\t\t$this->template->write('title', \"Gestion des OP - Seraseran'ny Tantsaha\");\n\t\tif (!$this->upload->do_upload()){\n\t\t\t$errors = array('error' => $this->upload->display_errors());\n\t\t\t$data[\"user\"] = $this->session->userdata(\"user\");\n\t\t\t$data['errors'] = $errors;\n\t\t\t$data[\"active\"] = \"op\";\n\t\t\t$this->template->write_view('header', 'partials/header', $data);\n\t\t\t$this->template->write_view('content', '/op/doimport', $data);\n\t\t\t$this->template->render();\n\t\t}\n\t\telse {\n\t\t\t$dataUpload = $this->upload->data();\n\t\t\t$sheetData = $this->processFile($dataUpload['full_path']);\n\t\t\t$data = $this->xls2op($sheetData);\n\t\t\t$data[\"user\"] = $this->session->userdata(\"user\");\n\t\t\t$data[\"active\"] = \"op\";\n\t\t\t$this->template->write_view('header', 'partials/header', $data);\n\t\t\t$this->template->write_view('content', '/op/doimport', $data);\n\t\t\t$this->template->render();\n\t\t}\n\t}", "public function import($data);", "function import_identifie_id_type($values, $table, $desc, $request) {\n\t$e = $values['extension'];\n\t$t = $values['titre'];\n\t$r = sql_fetsel(\"id_type AS id, titre\", \"spip_types_documents\", \"extension=\" . sql_quote($e) . \" AND titre=\" . sql_quote($t));\n\treturn $r ? array($r['id'], $r['titre']) : false;\n}", "public function getImportEntity();", "public function import($import)\n {\n //parse le xml\n $this->parse($import,false);\n\n\n\n $note=\"Parse OK \".count($this->nuxeotab).\" objets\";\n\n $nuxeo=new NuxeoGestion;\n\n //crée un folder\n //$idfolder=$nuxeo->createDocument(\"1f992202-3b57-4e14-a649-f370b15c0e55\",\"Folder\",\"laravel folder\".date(\"Y-m-d H:i:s\"));\n /*\n $idfolder=\"1f992202-3b57-4e14-a649-f370b15c0e55\";\n //crée le document\n $id=$nuxeo->createDocument($idfolder,\"File\",\"laravel \".date(\"Y-m-d H:i:s\"));\n //crée un batch e trécupère son id\n $batchid=$nuxeo->createbatch();\n //on upload le fichier\n $upload=$nuxeo->uploadFile('patate.jpg',\"patate.jpg\",$batchid);\n\n\n\n $nuxeo->linkUploadedFile($id,$batchid);\n */\n\n #$id=$nuxeo->createDocumentWithFile(\"1f992202-3b57-4e14-a649-f370b15c0e55\",\"BBB62.mp4\",\"Une video de lapin\");\n\n\n\n //$note=\"<a href=https://ged.mines-telecom.fr/nuxeo/nxdoc/default/\".$id.\"/view_documents>Lien vers document</a>\";\n\n //creation du document racine \"nuxeoroot\"\n print $this->nuxeoroot;\n\n #print_r($this->nuxeotab);\n\n $id=$nuxeo->createDocument(\"1f992202-3b57-4e14-a649-f370b15c0e55\",'Folder',$this->nuxeotab[$this->nuxeoroot]['title']);\n\n //creation de la descendance ( arborescence )\n\n $out=$nuxeo->createChilds($id,$this->nuxeoroot,$this->nuxeotab,$this->nuxeoroot);\n\n\n\n //test : creation à plat des docs\n /* dev desactive = creation a plat\n\n\n $ok=0;\n foreach ($this->nuxeotab as $key => $value) {\n print \"racine =\".$this->nuxeoroot;\n print \"key \". $key ;\n print_r($value);\n print\"<br><br>\";\n\n\n if($value['type']=='Document')\n {\n /*print \"<font color=red>import !!</font><br>\";\n\n $pathtodoc=\"/\".$import.\"/documents/r_\".$key;\n print $pathtodoc.\"<br>\";*//*\n $pathtodoc=\"\".$import.\"/documents/r_\".$key.\"_0\";\n $id=$nuxeo->createDocumentWithFile(\"1f992202-3b57-4e14-a649-f370b15c0e55\",$pathtodoc,$value['title']);\n $ok=1;\n }\n\n\n\n\n\n\n }\n dev deactive fin*/\n\n //$note=\"\";\n $id=\"\";\n\n return view('generic_view')->withNote('Message '.$note.\" \".$id)->withDatas([]);\n\n }", "function uuid_badge_file_field_import(&$import, $entity_type) {\n $import_bundle = 'badge';\n // Get all fields from this bundle.\n $fields = field_info_instances($entity_type, $import_bundle);\n\n foreach($fields as $field_instance) {\n // Load field info to check the type.\n $field = &$import->{$field_instance['field_name']};\n $info = field_info_field($field_instance['field_name']);\n $supported_fields = array_map('trim', explode(',', variable_get('uuid_features_file_supported_fields', 'file, image')));\n // Check if this field should implement file import/export system.\n if (!empty($field) && in_array($info['type'], $supported_fields)) {\n // We need to loop into each language because i18n translation can build\n // fields with different language than the term one.\n foreach($field as $language => $files) {\n if (is_array($files)) {\n foreach($files as $i => $file) {\n // Convert file to array to stay into the default uuid_features_file format.\n $file = (object)$file;\n $result = _uuid_features_file_field_import_file($file);\n // The file was saved successfully, update the file field (by reference).\n if ($result == TRUE && isset($file->fid)) {\n $field[$language][$i] = (array)$file;\n }\n else {\n $field[$language][$i] = array();\n }\n }\n }\n }\n }\n }\n}" ]
[ "0.6843686", "0.68324286", "0.65698546", "0.6509697", "0.64002514", "0.6307703", "0.6180285", "0.61728", "0.61216813", "0.610118", "0.6026187", "0.6018599", "0.6002192", "0.6002192", "0.5996775", "0.598101", "0.5947939", "0.59423554", "0.59416556", "0.59267384", "0.59202194", "0.58598626", "0.583686", "0.58216363", "0.5817607", "0.5803249", "0.5776623", "0.57022446", "0.570189", "0.5678879" ]
0.7372177
0
[importar_entradas_post recogemos, procesamos y guardamos los elementos del archivo que subimos]
public function importar_entradas_post(Request $request){ //datos comunes de las vistas $datos_vista = $this->cargar_datos(); //recogeos el nombre del tipo de importacion $tipo_importacion = $request->tipo_importacion; //declaramos el metodo que vamos utilizar segun el tipo de importacion $metodo = 'cargar_archivo_'.$tipo_importacion; //recogemos el array de entradas que nos devuelve el metodo declarado $array_entradas = $this->$metodo(); //guardamos las nuevas entradas en la base de datos $guardar_entradas_importadas = $this->guardar_entradas_importadas($array_entradas); //definimos el paso en que nos encontramos $datos_vista['paso'] = 'resumen-importar-entradas'; //definimos el numero de las nuevas entradas $datos_vista['num_entradas'] = count($array_entradas); return return_vistas('blogs.importar-entradas', $datos_vista); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function guardar_entradas_importadas($entradas = null){\n\n foreach ($entradas as $entrada) {\n \n //por defecto declaramos NULL el categoria_id de las entradas\n $entrada['categoria_id'] = NULL;\n\n //si hya categorias declarada la guardamos y obtenemos su id\n if(!is_null($entrada['categoria'])){\n\n //recogemos el nombre de la categoria, en formato slug \n $categoria_slug = normalizar_string($entrada['categoria']);\n\n //buscamos el slug en la base de dados\n $categoria_db = Categoria::where('slug',$categoria_slug)->first();\n\n //si la categoria no exites, la creamos\n if(!$categoria_db){\n $categoria_new = new Categoria;\n $categoria_new->nombre = $entrada['categoria'];\n $categoria_new->slug = $categoria_slug;\n $categoria_new->save();\n\n $categoria_db = $categoria_new;\n }\n\n //recoremos el id de la categorias\n $entrada['categoria_id'] = $categoria_db->id;\n\n }\n\n //todas las entras que importamos son borradores\n $entrada['borrador'] = true;\n\n //guardamos la nueva entrada en la base de datos\n $entrada_new = Blog::create($entrada);\n $entrada['blog_id'] = $entrada_new->id;\n\n //guardamos las etiquetas de la entrada \n BlogTag::where('blog_id',$entrada_new->id)->delete();\n\n $tags_objeto = explode(\",\",$entrada['etiquetas']);\n\n foreach ($tags_objeto as $tags => $value) {\n $db['blog_id'] = $entrada_new->id;\n $db['tag'] = $value;\n BlogTag::insert($db);\n }\n\n //guardamos las configuracion seo de la entrada;\n $entrada_seo = BlogSeo::create($entrada);\n \n }\n }", "function importar_pa($array_hoja)\n {\n $no_importados = array();\n $fila = 2; //Inicia en la fila 2 de la hoja de cálculo\n \n //Predeterminados registro nuevo\n $arr_row['tipo_id'] = 121;\n $arr_row['referente_2_id'] = 1; //Pública, agregada por ELE\n\n $this->load->model('Post_model');\n \n foreach ( $array_hoja as $array_fila )\n {\n //Identificar valores\n $tema_id = $this->Pcrn->campo('tema', \"cod_tema = '{$array_fila[0]}'\", 'id');\n \n //Complementar registro\n $arr_row['referente_1_id'] = $tema_id;\n $arr_row['contenido'] = $array_fila[1];\n \n //Validar\n $condiciones = 0;\n if ( ! is_null($tema_id) ) { $condiciones++; } //Tiene tema identificado\n if ( strlen($arr_row['contenido']) > 0 ) { $condiciones++; } //Tiene contenido texto escrito\n \n //Si cumple las condiciones\n if ( $condiciones == 2 )\n { \n $this->Post_model->guardar_post('id = 0', $arr_row); //Condición imposible, siempre agrega\n } else {\n $no_importados[] = $fila;\n }\n \n $fila++; //Para siguiente fila\n }\n \n return $no_importados;\n }", "public function executeImportarEjercicios()\n {\n $this->errors = array();\n $mensaje_importar = '';\n\n // Si se ha hecho submit procesamos el formulario\n if ($this->getRequest()->getMethod() == sfRequest::POST) {\n if ($this->getRequest()->getFileName('my_file')) {\n if (is_readable($_FILES['my_file']['tmp_name'])) {\n $my_file = $_FILES['my_file']['tmp_name'];\n $id_materia = $this->getRequestParameter('materia');\n $xml = simplexml_load_file($my_file);\n if (!$xml) {$this->errors[] = 'Fichero XML incorrecto - fallo en load'; return;}\n\n $ejercicio = new Ejercicio();\n $solucion_ejercicio = new Ejercicio_resuelto();\n\n if ($xml->getName() != 'ejercicio') {$this->errors[] = 'Fichero XML incorrecto - fallo en esquema 1'; return;}\n\n $id_admin = $this->getUser()->getAnyId();\n $solucion_ejercicio->setIdAutor($id_admin);\n $ejercicio->setIdAutor($id_admin);\n $ejercicio->setIdMateria($id_materia);\n $ejercicio->setNombreAutor((string) $xml['nombre_autor']);\n $tipo = $xml['tipo'];\n $ejercicio->setTipo((string) $xml['tipo']);\n $ejercicio->setTitulo((string) $xml['titulo']);\n $ejercicio->setTestMultiple((int) $xml['test_multiple']);\n $ejercicio->setTestResta((int) $xml['test_resta']);\n $numero_respuestas_test = (int) $xml['numero_respuestas'];\n $ejercicio->setNumeroRespuestas($numero_respuestas_test);\n $ejercicio->setSolucion((int) $xml['solucion']);\n $ejercicio->setExpresionesMatematicas((int) $xml['expresiones_matematicas']);\n $ejercicio->setNumeroHojas((int) $xml['numero_hojas']);\n\n $expmat = $ejercicio->getExpresionesMatematicas();\n\n $array_cuestiones = array();\n $array_soluciones = array();\n $index1 = 0;\n\n foreach ($xml->children() as $cuestion) {\n if ($cuestion->getName() != 'cuestion') {$this->errors[] = 'Fichero XML incorrecto - fallo en esquema 2'; return;}\n\n switch ($tipo) {\n case 'test':\n $enunciado = (string) $cuestion->pregunta;\n $cref = new Cuestion_test();\n $cref->setPregunta($enunciado);\n $cref->setNumeroRespuestasCorrectas((int) $cuestion['ncorrectas']);\n $cref->setNumeroRespuestasIncorrectas((int) $cuestion['nincorrectas']);\n $array_cuestiones[$index1] = $cref;\n\n $index2 = 0;\n foreach ($cuestion->respuestas->respuesta as $respuesta) {\n $rref = new Respuesta_cuestion_test();\n if ($respuesta['correcta']) {\n $correcta = (int) $respuesta['correcta'];\n } else {\n $correcta = 0;\n }\n $rref->setCorrecta($correcta);\n $rref->setRespuesta((string) $respuesta);\n $array_soluciones[\"$index1.$index2\"] = $rref;\n $index2++;\n }\n $index1++;\n break;\n\n case 'cuestionario':\n $enunciado = (string) $cuestion->pregunta;\n $puntuacion = (string) $cuestion['puntuacion'];\n\n $cref = new Cuestion_corta();\n $cref->setPregunta($enunciado);\n $cref->setPuntuacion($puntuacion);\n $array_cuestiones[] = $cref;\n\n $solucion = (string) $cuestion->solucion;\n $sref = new Respuesta_cuestion_corta();\n $sref->setRespuesta($solucion);\n $array_soluciones[] = $sref;\n break;\n\n case 'problemas':\n $enunciado = (string) $cuestion->pregunta;\n $puntuacion = (string) $cuestion['puntuacion'];\n\n $cref = new Cuestion_practica();\n $cref->setContenidoLatex($enunciado);\n $cref->setPuntuacion($puntuacion);\n $array_cuestiones[] = $cref;\n break;\n default: break;\n }\n }\n // Bucle2\n switch ($tipo) {\n case 'test':\n $ejercicio->save();\n $solucion_ejercicio->setIdEjercicio($ejercicio->getId());\n $solucion_ejercicio->save();\n $ejercicio->setIdSolucion($solucion_ejercicio->getId());\n $ejercicio->save();\n\n $index1 = 0;\n foreach ($array_cuestiones as $cref) {\n $cref->setIdEjercicio($ejercicio->getId());\n $cref->save();\n\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(1, 't', $cref->getId(), $cref->getPregunta());\n }\n for ($index2 = 0; $index2 < $numero_respuestas_test; $index2++) {\n $rref = $array_soluciones[\"$index1.$index2\"];\n $rref->setIdCuestionTest($cref->getId());\n $rref->save();\n\n if ($rref->getCorrecta()) {\n $sref = new Seleccion_cuestion_test();\n $sref->setIdEjercicioResuelto($solucion_ejercicio->getId());\n $sref->setIdRespuestaCuestionTest($rref->getId());\n $sref->save();\n }\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(0, 't', $rref->getId(), $rref->getRespuesta());\n }\n }\n $index1++;\n }\n break;\n\n case 'cuestionario':\n // Guardamos el ejercicio y sus preguntas si todo fue bien\n $ejercicio->save();\n $solucion_ejercicio->setIdEjercicio($ejercicio->getId());\n $solucion_ejercicio->save();\n $ejercicio->setIdSolucion($solucion_ejercicio->getId());\n $ejercicio->save();\n\n for ($index = 0; $index < sizeof($array_cuestiones); $index++) {\n $cref = $array_cuestiones[$index];\n $cref->setIdEjercicio($ejercicio->getId());\n $cref->save();\n\n $sref = $array_soluciones[$index];\n $sref->setIdCuestionCorta($cref->getId());\n $sref->setIdEjercicioResuelto($solucion_ejercicio->getId());\n $sref->save();\n\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(1, 'c', $cref->getId(), $cref->getPregunta());\n $this->crearExpMat(0, 'c', $sref->getId(), $sref->getRespuesta());\n }\n }\n break;\n\n case 'problemas':\n // Guardamos el ejercicio y sus preguntas si todo fue bien\n $ejercicio->save();\n $solucion_ejercicio->setIdEjercicio($ejercicio->getId());\n $solucion_ejercicio->save();\n $ejercicio->setIdSolucion($solucion_ejercicio->getId());\n $ejercicio->save();\n\n for ($index = 0; $index < sizeof($array_cuestiones); $index++) {\n $cref = $array_cuestiones[$index];\n $cref->setIdEjercicio($ejercicio->getId());\n $cref->save();\n\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(1, 'p', $cref->getId(), $cref->getContenidoLatex());\n }\n }\n break;\n default: break;\n }\n $mensaje_importar = '<strong>El ejercicio \"'.$ejercicio->getTitulo().'\" importado satisfactoriamente</strong>';\n $this->ejercicio = $ejercicio; // necesario para los test\n }\n }\n }\n $c = new Criteria();\n $this->materias = MateriaPeer::DoSelect($c);\n $this->errors = $this->errors;\n $this->mensaje_importar = $mensaje_importar;\n }", "public function importa_estados_pedido () {\r\r\n\r\r\n\t\t\tif (!defined ('DOING_AJAX') || !DOING_AJAX)\r\r\n\t\t\t\treturn false;\r\r\n\r\r\n\t\t\t$estados = wp_list_pluck ($this->pide_query(), 'post_name');\r\r\n\t\t\t$terceros = $this->estados_pedidos_terceros();\r\r\n\r\r\n\t\t\t$campos = array(\r\r\n\t\t\t\t'color'\t\t=> 'field_59e21e12b35d0',\r\r\n\t\t\t\t'sigestado'\t=> 'field_5c62a17632be7',\r\r\n\t\t\t\t'icono'\t\t=> 'field_56e212fcf3ca0',\r\r\n\t\t\t\t'informes'\t=> 'field_59e232bcf1cf0',\r\r\n\t\t\t\t);\r\r\n\r\r\n\t\t\tforeach ($terceros as $tercero) {\r\r\n\r\r\n\t\t\t\tif (!in_array($tercero->post_name, $estados)) {\r\r\n\r\r\n\t\t\t\t\t$estado = get_post ($tercero->ID);\r\r\n\t\t\t\t\t$slug = (strlen ($tercero->post_name) > 15 || substr_count ($tercero->post_name, '-') > 1) ? (string) rand (100, 999) . substr (str_replace ('-', '', $tercero->post_name), 0, 12) : $tercero->post_name;\r\r\n\t\t\t\t\t$nuevo = array(\r\r\n\t\t\t\t\t\t'post_title'\t=> $estado->post_title,\r\r\n\t\t\t\t\t\t'post_type'\t\t=> Estados_Pedido_CPT::CPT,\r\r\n\t\t\t\t\t\t'post_status' \t=> 'publish',\r\r\n\t\t\t\t\t\t'post_name'\t\t=> $slug,\r\r\n\t\t\t\t\t\t);\r\r\n\r\r\n\t\t\t\t\tif (is_int ($id = wp_insert_post ($nuevo, false))) { //Generamos el nuevo estado de pedido\r\r\n\r\r\n\t\t\t\t\t\t//Comprobamos si hay pedidos en ese estado y los pasamos al nuevo\r\r\n\r\r\n\t\t\t\t\t\t$pedidos = wc_get_orders (['status' => $tercero->post_name]);\r\r\n\r\r\n\t\t\t\t\t\tforeach ($pedidos as $pedido)\r\r\n\t\t\t\t\t\t\twp_insert_post (\r\r\n\t\t\t\t\t\t\t\tarray(\r\r\n\t\t\t\t\t\t\t\t\t'ID'\t\t\t=> $pedido->get_id(),\r\r\n\t\t\t\t\t\t\t\t\t'post_status'\t=> 'wc-' . $slug,\r\r\n\t\t\t\t\t\t\t\t\t)\r\r\n\t\t\t\t\t\t\t\t);\r\r\n\r\r\n\t\t\t\t\t\t//Integración con WooCommerce Order Status Manager\r\r\n\r\r\n\t\t\t\t\t\tif ($color = get_post_meta ($tercero->ID, '_color', true)) {\r\r\n\r\r\n\t\t\t\t\t\t\tupdate_post_meta ($id, '_color', $campos['color']);\r\r\n\t\t\t\t\t\t\tupdate_post_meta ($id, 'color', $color);\r\r\n\t\t\t\t\t\t\t}\r\r\n\r\r\n\t\t\t\t\t\t$icono = get_post_meta ($tercero->ID, '_action_icon', true) or\r\r\n\t\t\t\t\t\t\t$icono = get_post_meta ($tercero->ID, '_icon', true);\r\r\n\r\r\n\t\t\t\t\t\tif ($icono && $codigo = array_search ('<span class=\"' . $icono . '\"></span>', Campos_Estados_Pedido::devuelve_iconos())) {\r\r\n\r\r\n\t\t\t\t\t\t\tupdate_post_meta ($id, '_icono', $campos['icono']);\r\r\n\t\t\t\t\t\t\tupdate_post_meta ($id, 'icono', $codigo);\r\r\n\t\t\t\t\t\t\t}\r\r\n\r\r\n\t\t\t\t\t\tif ($siguiente = get_post_meta ($tercero->ID, '_next_statuses', true)) {\r\r\n\r\r\n\t\t\t\t\t\t\tupdate_post_meta ($id, '_sigestado', $campos['sigestado']);\r\r\n\t\t\t\t\t\t\tupdate_post_meta ($id, 'sigestado', $siguiente[0]);\r\r\n\t\t\t\t\t\t\t}\r\r\n\r\r\n\t\t\t\t\t\tif ('yes' == get_post_meta ($tercero->ID, '_is_paid', true)) {\r\r\n\r\r\n\t\t\t\t\t\t\tupdate_post_meta ($id, '_informes', $campos['informes']);\r\r\n\t\t\t\t\t\t\tupdate_post_meta ($id, 'informes', array('incluir'));\r\r\n\t\t\t\t\t\t\t}\r\r\n\t\t\t\t\t\t}\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t}\r\r\n\r\r\n\t\t\tdie();\r\r\n\t\t\t}", "function importArticles() {\n\t\t\t\n\t\t\t//Qui dovrei importare il file dall'FTP alla mia cartella uploads\n\t\t\t\n\t\t\t//Assumo che il file sia presente\n\t\t\t$importPath = DM_APP_PATH . DS . 'uploads' . DS . 'ANAGRAFICA.TXT';\n\t\t\t\n\t\t\trequire_once(DM_APP_PATH . DS . 'helpers' . DS . 'articlehelper.php');\n\t\t\t$result = FHArticleHelper::importArticlesFromFile($importPath, false);\n\t\t\t\n\t\t\tprint_r($result);\n\t\t\t\n\t\t\t//Deve scaricare lo zip e scompattarlo in /media/articles\n\t\t\t\n\t\t\texit;\n\t\t\t\n\t\t}", "function import() {\n Configure::write('debug', 0);\n $id = $this->Avisosrepuesto->id;\n $this->set('avisosrepuesto', $this->Avisosrepuesto->find('first', array('contain' => array('Albaranescliente' => 'Cliente', 'Presupuestosproveedore' => 'Proveedore', 'Presupuestoscliente' => 'Cliente', 'ArticulosAvisosrepuesto' => 'Articulo', 'Cliente', 'Centrostrabajo', 'Maquina', 'Almacene', 'Estadosaviso'), 'conditions' => array('Avisosrepuesto.id' => $id))), 'estadosaviso');\n // echo \"id= \". $this->Avisosrepuesto->id . \"<br />\"; \n//Upload File\n if (isset($_POST['idAviso'])) {\n $id = $_POST['idAviso'];\n }\n if (isset($_POST['idAlmacene'])) {\n $idAlmacen = $_POST['idAlmacene'];\n }\n\n if (isset($_POST['submit'])) {\n\n if (is_uploaded_file($_FILES['filename']['tmp_name'])) {\n //echo \"<h1>\" . \"El fichero \" . $_FILES['filename']['name'] . \" uploaded successfully.\" . \"</h1>\";\n $resultadoUpload = \"El fichero <b>\" . $_FILES['filename']['name'] . \"</b> subido con éxito. <br />\";\n /* echo \"<h2>Displaying contents:</h2>\";\n readfile($_FILES['filename']['tmp_name']); */\n }\n //Import uploaded file to Database en modo Lectura\n $handle = fopen($_FILES['filename']['tmp_name'], \"r\");\n $cntRegistros = 0;\n $cntInsert = 0;\n $cntNoProcede = 0;\n $resultadoIncidencias = \"<ol>\";\n $flag = true; // para saltar la cabecera\n while (($data = fgetcsv($handle, 1000, \";\")) !== FALSE) {\n if ($flag) {\n $flag = false;\n continue;\n }\n $cntRegistros ++;\n // buscados el idArticulo por la referencia\n $consulta = sprintf(\"SELECT id, count(*) as total FROM articulos \n WHERE UPPER(ref) LIKE UPPER('%s') \n AND almacene_id = %s\", '%' . mysql_real_escape_string($data[0]) . '%', $idAlmacen);\n\n// Ejecutar la consulta\n $resultadoSQL = mysql_query($consulta);\n if (!$resultadoSQL) {\n $mensaje = 'Consulta no válida: ' . mysql_error() . '. Consulta completa: ' . $consulta;\n die($mensaje);\n }\n\n //$resultado .= $consulta . '<br />';\n // echo $consulta . ' id= ' . $dataSQL['id'] . ' total= ' . $dataSQL['total'] . '<br />';\n $dataSQL = mysql_fetch_assoc($resultadoSQL);\n //echo \"Registros con ref \" . $data[0] . \" coincide = \" . $dataSQL['total'] . '<br />';\n // Depende del resultado obtenido \n $articulo_id = $dataSQL['id'];\n\n switch ($dataSQL['total']) {\n case 0:\n $resultadoIncidencias .= sprintf(\"<li> Referencia = %s ,\"\n . \" <span style='color:red;font-weight:bold'> NO existe </span> como articulo en el Sistema.</li>\"\n , $data[0] );\n $cntNoProcede ++;\n break;\n case 1:\n $insertOrUpdate = \"INSERT INTO articulos_avisosrepuestos (avisosrepuesto_id, articulo_id, cantidad) \"\n . \"values('$id','$articulo_id', '$data[1]')\";\n $cntInsert ++;\n break;\n default :\n $resultadoIncidencias .= sprintf(\"<li> Referencia = %s, \"\n . \"<span style='color:red;font-weight:bold'>, Coincide más de un articulo </span> con esta referencia \"\n . '. Comprobar = %s </li>'\n , $data[0], $consulta);\n $cntNoProcede ++;\n } // switch \n\n if (strlen($insertOrUpdate) > 0) {\n $resultado2SQL = mysql_query($insertOrUpdate);\n if (!$resultado2SQL) {\n $mensaje = 'Consulta no válida: ' . mysql_error() . \"\\n\";\n $mensaje .= 'Consulta completa: ' . $insertOrUpdate;\n die($mensaje);\n }\n }\n $insertOrUpdate = \"\";\n } // While\n fclose($handle);\n\n $resultadoResumen = \" Total de registros analizados : \" . $cntRegistros . '<br />'\n . \" Articulos creados en el aviso : \" . $cntInsert . '<br />'\n . \" Registros NO procesados por incidencias : \" . $cntNoProcede;\n\n $this->set('resultadoUpload', isset($resultadoUpload) ? $resultadoUpload : \" \" );\n $this->set('resultadoResumen', isset($resultadoResumen) ? $resultadoResumen : \" \" );\n $this->set('resultado', (isset($resultadoIncidencias) ? $resultadoIncidencias : \" \" ) . \"</ol>\");\n $this->Session->setFlash(__('Importación finalizada con éxito .', true));\n } else {\n $this->set('resultadoResumen', \"\");\n $this->set('resultadoUpload', \"No hay fichero a subir\");\n }\n }", "public function import($import)\n {\n //parse le xml\n $this->parse($import,false);\n\n\n\n $note=\"Parse OK \".count($this->nuxeotab).\" objets\";\n\n $nuxeo=new NuxeoGestion;\n\n //crée un folder\n //$idfolder=$nuxeo->createDocument(\"1f992202-3b57-4e14-a649-f370b15c0e55\",\"Folder\",\"laravel folder\".date(\"Y-m-d H:i:s\"));\n /*\n $idfolder=\"1f992202-3b57-4e14-a649-f370b15c0e55\";\n //crée le document\n $id=$nuxeo->createDocument($idfolder,\"File\",\"laravel \".date(\"Y-m-d H:i:s\"));\n //crée un batch e trécupère son id\n $batchid=$nuxeo->createbatch();\n //on upload le fichier\n $upload=$nuxeo->uploadFile('patate.jpg',\"patate.jpg\",$batchid);\n\n\n\n $nuxeo->linkUploadedFile($id,$batchid);\n */\n\n #$id=$nuxeo->createDocumentWithFile(\"1f992202-3b57-4e14-a649-f370b15c0e55\",\"BBB62.mp4\",\"Une video de lapin\");\n\n\n\n //$note=\"<a href=https://ged.mines-telecom.fr/nuxeo/nxdoc/default/\".$id.\"/view_documents>Lien vers document</a>\";\n\n //creation du document racine \"nuxeoroot\"\n print $this->nuxeoroot;\n\n #print_r($this->nuxeotab);\n\n $id=$nuxeo->createDocument(\"1f992202-3b57-4e14-a649-f370b15c0e55\",'Folder',$this->nuxeotab[$this->nuxeoroot]['title']);\n\n //creation de la descendance ( arborescence )\n\n $out=$nuxeo->createChilds($id,$this->nuxeoroot,$this->nuxeotab,$this->nuxeoroot);\n\n\n\n //test : creation à plat des docs\n /* dev desactive = creation a plat\n\n\n $ok=0;\n foreach ($this->nuxeotab as $key => $value) {\n print \"racine =\".$this->nuxeoroot;\n print \"key \". $key ;\n print_r($value);\n print\"<br><br>\";\n\n\n if($value['type']=='Document')\n {\n /*print \"<font color=red>import !!</font><br>\";\n\n $pathtodoc=\"/\".$import.\"/documents/r_\".$key;\n print $pathtodoc.\"<br>\";*//*\n $pathtodoc=\"\".$import.\"/documents/r_\".$key.\"_0\";\n $id=$nuxeo->createDocumentWithFile(\"1f992202-3b57-4e14-a649-f370b15c0e55\",$pathtodoc,$value['title']);\n $ok=1;\n }\n\n\n\n\n\n\n }\n dev deactive fin*/\n\n //$note=\"\";\n $id=\"\";\n\n return view('generic_view')->withNote('Message '.$note.\" \".$id)->withDatas([]);\n\n }", "function importarArquivo() {\n \n $sMsgErro = \"Importação de Arquivo Censo abortada!\\n\"; \n if (!db_utils::inTransaction()) {\n throw new Exception(\"Nenhuma transação do banco encontrada!\");\n }\n \n $this->sNomeArquivoLog = \"tmp/censo\".$this->iAnoEscolhido.\"_importacao_\".db_getsession(\"DB_coddepto\").\"_\";\n $this->sNomeArquivoLog .= db_getsession(\"DB_id_usuario\").\"_\".date(\"dmY\").\"_\".date(\"His\").\"_log.txt\";\n \n $this->pArquivoLog = fopen($this->sNomeArquivoLog, \"w\"); \n if (!$this->pArquivoLog) {\n throw new Exception(\" Não foi possível abrir o arquivo de log! \"); \n } \n \n if ($this->lIncluirAlunoNaoEncontrado) { \n $this->log(\"Registros atualizados na importação do Censo Escolar:\\n\\n\");\n } else {\n $this->log(\"Registros não atualizados na importação do Censo Escolar:\\n\\n\"); \n }\n \n try {\n \n $this->validaArquivo(); \n $this->getLinhasArquivo($this->iCodigoLayout); \n $aLinhasArquivo = $this->getLinhasArquivo();\n \n \n } catch (Exception $eException) {\n throw new Exception($sMsgErro.\" \".$eException->getMessage());\n }\n \n foreach ($aLinhasArquivo as $iIndLinha => $oLinha) {\n \t\n if ($this->lImportarEscola) {\n \t\n \tif ($oLinha->tiporegistro == \"00\") {\n \t $this->atualizaCodigoInepEscola($oLinha);\n \t}\n \t\n }\t\n \n if ($this->lImportarTurma) {\n \t\n \tif ($oLinha->tiporegistro == \"20\") {\n \t $this->atualizaCodigoInepTurma($oLinha);\n \t}\n \t\n }\n \n if ($this->lImportarDocente) {\n \t\n \tif ($oLinha->tiporegistro == \"30\") {\n \t $this->atualizaCodigoInepDocente($oLinha);\n \t}\n \t\n }\n \n if ($this->lImportarAluno) {\n \t\n \tif ($oLinha->tiporegistro == \"60\") {\n \t $this->atualizaCodigoInepAluno($oLinha);\n \t}\n \t\n }\n \n }\n\n }", "public function actionImportar()\n\t{\n\t\t// renders the view file 'protected/views/site/index.php'\n\t\t// using the default layout 'protected/views/layouts/main.php'\t\t\n\t\t$model = new ImportarForm();\n\t\t$reg = 0;\n\t\t$archivos = CUploadedFile::getInstancesByName('archivo');\n\t\tif ((count($archivos) > 0) or (isset($_POST[\"ImportarForm\"][\"archivos_subidos\"]) and $_POST[\"ImportarForm\"][\"archivos_subidos\"] == 1)) {\n\t\t\t$model->attributes = $_POST[\"archivo\"];\n\t\t\tif (count($archivos) > 0) {\n\t\t\t\t$model->archivo = $archivos[0];\n\t\t\t} else {\n\t\t\t\t$model->archivo = null;\n\t\t\t}\n\t\t\tif ($model->validate()) {\n\t\t\t\t// aqui entra CFileValidator\n\t\t\t\t//$filename = sys_get_temp_dir().'/'.$model->archivo->getName();\n\t\t\t\t/*if (isset($_POST[\"ImportarForm\"][\"archivos_subidos\"]) and $_POST[\"ImportarForm\"][\"archivos_subidos\"] == 1) {\n\t\t\t\t\t//recupero los archivos que esten en la carpeta temporal y los importo\n\t\t\t\t\t$archivos_generados = $this->showFiles();\n\t\t\t\t} else {\n\t\t\t\t\t$model->archivo->saveAs($model->archivo->getName());\n\t\t\t\t\t// trunco el archivo en mas chicos para agilizar la carga\n\t\t\t\t\t$archivos_generados = $this->truncarArchivo($model->archivo->getName());\n\t\t\t\t\tunlink($model->archivo->getName());// borro el archivo original \n\t\t\t\t}*/\n\t\t\t\t$model->archivo->saveAs($model->archivo->getName());\n\t\t\t\t//$xmlStr = file_get_contents($model->archivo->getName());\n\t\t\t\t//$xml = simpleXML_load_file($model->archivo->getName());\t\n\t\t\t\t$texto = file_get_contents($model->archivo->getName());\n\t\t\t\t$xml = new SimpleXMLElement($texto);\n\n\t\t\t\t//$xml = new SimpleXMLElement(file_get_contents($model->archivo->getName()));\n\t\t\t\tif ($xml === FALSE) {\n\t\t\t\t\tYii::log(\"Error importar análisis - No se pudo abrir\", CLogger::LEVEL_WARNING, __METHOD__);\n\t\t\t\t} else {\n\t\t\t\t\t$errores = array();\n\t\t\t\t\t/*AnalisisController::normalizeSimpleXML($xml, $result);*/\t\t\t\t\t\n\t\t\t\t\t$campo_conf='conf_import'.$_POST['config'];\t\n\t\t\t\t\t// arreglos con los cod dep de la conf de corredor, a futuro pasar a otra funcion\n\t\t\t\t\t$codigos_peso_hectlitrico \t= [1=>1,2=>null,3=>null];\n\t\t\t\t\t$codigos_conte_proteico \t= [1=>27,2=>null,3=>null];\n\n\n\t\t\t\t\tforeach ($xml->children() as $solicitud) {\n\t\t\t\t\t\t$contador = 0;\n\t\t\t\t\t\t$cartaP = (string) $solicitud->CamionVagon->Item['NumeroDeCartaDePorte'];\t\t\t\t\t\t\n\t\t\t\t\t\t$codProducto=(string) $solicitud->Matriz['Codigo'];\n\t\t\t\t\t\t// Recupero el producto por el cod dependiendo la conf seleccionada\n\t\t\t\t\t\t$prod = Producto::model()->find($campo_conf.'='.$codProducto);\n\t\t\t\t\t\t$prodDesc=(string) $solicitud->Matriz['Descripcion'];\n\t\t\t\t\t\tif(!$prod){\n\t\t\t\t\t\t\t// no se encontro el producto\n\t\t\t\t\t\t\tYii::log(\"Error importar análisis - No se encontro el producto \".$prodDesc, CLogger::LEVEL_WARNING, __METHOD__);\n\t\t\t\t\t\t\texit();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//<Matriz Codigo=\"2\" Descripcion=\"MAÍZ\" />\n\t\t\t\t\t\t//defino dos variables logicas para indicar si el el caso especial Peso Hecto y su valor es mayor igual a 75 y otra para ver si es Conte Pro\n\t\t\t\t\t\t$caso_peso_hect = false;\n\t\t\t\t\t\t$cont_proteico = 0;// guardo el id para luego actualizarlo\n\t\t\t\t\t\t// si no tiene EnsayoTecnica se toma, sino se ignora\n\t\t\t\t\t\tforeach ($solicitud->EnsayoTecnica as $ensayoTec) {\t\n\t\t\t\t\t\t\tif($contador == 0 ){\n\t\t\t\t\t\t\t\tprint_r('<br/>');\n\t\t\t\t\t\t\t\tprint_r('Prod: '.$codProducto.' - '.$prodDesc);\t\n\t\t\t\t\t\t\t\tprint_r('<br/>');\n\t\t\t\t\t\t\t\tprint_r('CP:'.$cartaP);\n\t\t\t\t\t\t\t\tprint_r('<br/>');\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t\t\t$contador++;\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$codRubro = (string) $ensayoTec->Ensayo['Codigo'];\n\t\t\t\t\t\t\t// Recupero el rubro por el cod dependiendo la conf seleccionada\n\t\t\t\t\t\t\t$rubro = Rubro::model()->find($campo_conf.'='.$codRubro);\n\t\t\t\t\t\t\t$valorRubro = (string) $ensayoTec->ResultadosYComponentes->ResultadoComponente->ResultadoDelEnsayo['Alfabetico'];\n\t\t\t\t\t\t\t// Recupero calculo valor\n\t\t\t\t\t\t\t$calc_valor = RubroCalculoValor::model()->find('producto='.$prod->id.' AND rubro='.$rubro.' AND valor_desde>'.$valorRubro.' AND '.$valorRubro.'=<valor_hasta');\n\t\t\t\t\t\t\tif(!$calc_valor){\n\t\t\t\t\t\t\t\t// VER que hacer si no se encontro el rubro_calculo_valor\n\t\t\t\t\t\t\t\tYii::log(\"Error importar análisis - No se encontro el rubro_calc_valor \".$prod->id.' - '.$rubro.' - '.$valorRubro, CLogger::LEVEL_WARNING, __METHOD__);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t// guardo en una variable el valor de castiga_bonifica si entra por el caso especial la sobreescribo con cero\n\t\t\t\t\t\t\t\t$mult_castiga_bonifica = $calc_valor->castiga_bonifica;\n\n\t\t\t\t\t\t\t\tif($codigos_peso_hectlitrico[$_POST['config']]==$rubro && $valorRubro >= 75){\n\t\t\t\t\t\t\t\t\t// prendo el flag\n\t\t\t\t\t\t\t\t\t$caso_peso_hect = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//Cond especial si el Conte. Prot es mayor a 11 y el Peso Hecto es mayor o igual a 75, toma castiga_bonifica de la tabla, si es menor a 75 castiga_bonifica es cero\n\t\t\t\t\t\t\t\tif($codigos_conte_proteico[$_POST['config']]==$rubro && $valorRubro > 11){\n\t\t\t\t\t\t\t\t\t// Estoy analizando Contenido Proteico y el valor es mayor a 11\n\t\t\t\t\t\t\t\t\tif($caso_peso_hect){\n\t\t\t\t\t\t\t\t\t\t// es el caso especial que el peso hect es mayor o igual a 75 \n\t\t\t\t\t\t\t\t\t\t$mult_castiga_bonifica=0; //NO BONIFICA\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t\t\t$diferencia = ($calc_valor->diferencia_valor_hasta == 1)? $calc_valor->valor_hasta - $valorRubro : 0; // consultar\n\t\t\t\t\t\t\t\t$calculo = $diferencia * $mult_castiga_bonifica;\n\t\t\t\t\t\t\t\t$adiciona = $calculo + $calc_valor->adicionar_a_castiga_bonifica;\n\t\t\t\t\t\t\t\t$adiciona = $calc_valor->bonifica==1 ? $adiciona : $adiciona * -1;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// grabo el analisis\n\t\t\t\t\t\t\t\t$analisis = new Analisis;\n\t\t\t\t\t\t\t\t$analisis->rubro = $rubro;\n\t\t\t\t\t\t\t\t$analisis->carta_porte = $cartaP;\n\t\t\t\t\t\t\t\t$analisis->producto = $prod->id;\n\t\t\t\t\t\t\t\t$analisis->bonifica_rebaja = $adiciona;\n\t\t\t\t\t\t\t\t$analisis->valor = $valorRubro;\n\t\t\t\t\t\t\t\t$analisis->usuario = Yii::app()->user->id;\n\t\t\t\t\t\t\t\tif(!$analisis->save()){\n\t\t\t\t\t\t\t\t\t$errores[$cartaP] =$analisis->getErrors();\n\t\t\t\t\t\t\t\t\tYii::log(\"Error importar análisis - No pudo insertar \".$analisis->getErrors(), CLogger::LEVEL_WARNING, __METHOD__);\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\tif($codigos_conte_proteico[$_POST['config']]==$rubro && !$caso_peso_hect){\n\t\t\t\t\t\t\t\t\t\t// Estoy analizando Contenido Proteico y aun no analice peso hecto, por lo que guardo el ID\n\t\t\t\t\t\t\t\t\t\t$cont_proteico = $analisis->id;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t$reg++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//print_r('CP:'.$cartaP.' Cod:'.$codRubro.' Valor:'.$valorRubro);\n\t\t\t\t\t\t\t//print_r('<br/>');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($contador >0 ){\t\n\t\t\t\t\t\t\t// reviso el caso especial \n\t\t\t\t\t\t\t// si llegue a esta punto y las dos variables estan en true y distinta de cero es pq analice primero Conte Proteico y luego Peso Hecto y además este último su valor es mayor o igual a 75\n\t\t\t\t\t\t\tif($caso_peso_hect && $cont_proteico!=0){\n\t\t\t\t\t\t\t\t// recalculo\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// busco si hay un rubro \"Peso Hectolitrico\" para esta carta de porte de ser así recalculo el rubro Contenido proteico. Si el valor de Peso Hect es menor a 75 el campo bonifica es cero\n\t\t\t\t\t\t\t// para la configuración 1 el cód también es 1\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//$_POST['config']\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (count($errores) > 0) {\n\t\t\t\t\t\t\t$msj = '';\n\t\t\t\t\t\t\t//print_r($errores); exit();\n\t\t\t\t\t\t\tforeach ($errores as $cp => $err) {\n\t\t\t\t\t\t\t\tforeach ($err as $attr => $msj_err) {\n\t\t\t\t\t\t\t\t\t$msj .= 'CP: ' . $cp . ' Campo: ' . $attr . '-' . $msj_err[0] . ' </br>';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tYii::app()->user->setFlash('danger', \"Error/es </br>\" . $msj);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tYii::app()->user->setFlash('success', \"Se importaron \" . $reg . \" registros nuevos.\");\t\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t$this->render('importar', array('model' => $model));\n\t}", "public function tipo_importacion(){\n\n //datos comunes de las vistas\n $datos_vista = $this->cargar_datos();\n\n //definimos el paso en que nos encotramos\n $datos_vista['paso'] = 'tipo-importacion';\n\n //tipos de importacion queda definido por el logo de la pagina desde donde se ha exportado el archivo\n $datos_vista['logos-importar-entradas'] = $this->imagenes_importar_entradas();\n\n return return_vistas('blogs.importar-entradas', $datos_vista); \n }", "public function store(Request $request)\n {\n //$this->authorize('create', Post::class);\n $request->validate([\n 'titulo' => 'required',\n 'contenido' => 'required',\n //'adjunto' => 'file'\n ]);\n \n $post = new Post();\n $post->titulo = $request['titulo'];\n $post->contenido = $request['contenido'];\n $post->autor()->associate(Auth::user()->docentes);\n $post->save();\n $lectura = new Lectura();\n $lectura->docentes()->associate(Auth::user()->docentes);\n $lectura->post()->associate($post);\n $lectura->save();\n if(isset($request['adjunto'])) {\n foreach ($request->file('adjunto') as $adjunto ) {\n //Armar el nombre del archivo:\n $ahora = new \\DateTime;\n $ahora = $ahora->format(\"YmdHis\");\n $nombre = \\Str::slug(\n pathinfo($adjunto->getClientOriginalName(),PATHINFO_FILENAME)\n );\n $extension = $adjunto->getClientOriginalExtension();\n $guardar_como = $ahora.'_'.$nombre.\".\".$extension;\n\n //Guardar archivo\n try {\n $path = $adjunto->storeAs('adjuntos', $guardar_como);\n //$post->archivo[] = $adjunto;\n }\n catch(\\Exception $e) {\n return redirect()->route('posts.index')\n ->with('error','Novedad guardada. Error con el archivo adjunto.');\n }\n\n //Guardar en la BD:\n $adj= new Adjunto();\n $adj->nombre_original = $nombre . \".\" . $extension;\n $adj->guardado_como = $guardar_como;\n $adj->post()->associate($post);\n $adj->save(); \n }\n }\n\n return redirect()->route('posts.index')\n ->with('success','Novedad publicada con éxito.');\n }", "Public Function importPosts() {\n\n\t\t$insertPostStatement = $this->localDatabase->prepare ( self::STMT_INSERT_POST );\n\t\t$insertPostTextStatement = $this->localDatabase->prepare ( self::STMT_INSERT_POST_TEXT );\n\t\t$insertAttachStatement = $this->localDatabase->prepare ( self::STMT_INSERT_ATTACHMENT );\n\t\t$updateAttachStatement = $this->localDatabase->prepare ( self::STMT_UPDATE_ATTACHMENT );\n\t\t$selectPostsStatement = $this->getRemoteQuery ( self::STMT_SELECT_POST );\n\n\t\t$postCount = 0;\n\t\tForEach($this->remoteDatabase->query($selectPostsStatement) As $post) {\n\n\t\t\tIf($post['post_attached']) {\n\t\t\t\t$localFilename = self::PATH_ATTACHMENT_MMFORUM.$post['post_attached'];\n\t\t\t\t$this->fileInterface->retrieveFile (\n\t\t\t\t\tself::PATH_ATTACHMENT_CHCFORUM.$post['post_attached'],\n\t\t\t\t\t$localFilename );\n\t\t\t\t$insertArray = Array ( ':pid' => $this->importConfiguration->getForumPid(),\n\t\t\t\t ':crdate' => $post['crdate'],\n\t\t\t\t ':type' => $this->getMimeType(PATH_site.$localFilename),\n\t\t\t\t ':size' => filesize($localFilename),\n\t\t\t\t ':path' => $localFilename,\n\t\t\t\t ':downloads' => 0 );\n\t\t\t\t$insertAttachStatement->execute($insertArray);\n\t\t\t\t$attachmentId = $this->localDatabase->lastInsertId();\n\t\t\t} Else $attachmentId = '';\n\n\t\t\t$insertArray = Array ( ':pid' => $this->importConfiguration->getForumPid(),\n\t\t\t ':topic' => $this->uidMapping['topics'][$post['thread_id']],\n\t\t\t ':forum' => $this->uidMapping['forums'][$post['conference_id']],\n\t\t\t ':user' => $this->uidMapping['users'][$post['post_author']],\n\t\t\t ':crdate' => $post['crdate'],\n\t\t\t ':ip' => dechex(ip2long($post['post_author_ip'])),\n\t\t\t ':attachment' => $attachmentId );\n\t\t\t$insertPostStatement->execute($insertArray);\n\t\t\t$postUid = $this->localDatabase->lastInsertId();\n\t\t\t$this->uidMapping['posts'][$post['post_id']] = $postUid;\n\n\t\t\tIf($attachmentId != '')\n\t\t\t\t$updateAttachStatement->execute(Array($postUid, $attachmentId));\n\n\t\t\t$text = $post['post_text'];\n\t\t\tIf($post['post_subject']) $text = '[b]'.$post['post_subject'].\"[/b]\\n\\n\".$text;\n\n\t\t\t$insertArray = Array ( ':pid' => $this->importConfiguration->getForumPid(),\n\t\t\t ':crdate' => $post['crdate'],\n\t\t\t ':post' => $postUid,\n\t\t\t ':text' => $text );\n\t\t\t$insertPostTextStatement->execute($insertArray);\n\t\t\t$postCount ++;\n\t\t}\n\n\t\t$this->pushLog(\"Imported $postCount posts.\");\n\n\t}", "function cargarVentas(){\n set_time_limit(0);\n $fechaActual = new DateTime('America/Bogota');\n $infofile = $_FILES['ven_archivo_ventas'];\n $location = $infofile['tmp_name'];\n $name = RUTA_PRINCIPAL . '/archivos/' . $infofile['name'];\n $res = 0;\n move_uploaded_file($location, $name);\n $file = fopen($name, 'r');\n \tfgets($file); //Se omite la primera línea porque son los titulos de las columnas\n \twhile (!feof($file)) {\n \t\t$line = fgets($file);\n \t\tif (empty($line)) {\n \t\t\tcontinue;\n \t\t}\n \t\t$array = explode(';', $line);\n \t\tif ($array[0] == null || empty($array[0])) {\n \t\t\tcontinue;\n \t\t}\n if ($this->ventasDAO->insertarVentas($array[0], $array[1], $array[2], $fechaActual->format('Y-m-d H:i:s'))) {\n $this->asignarRefMar($array[2]);\n $res = 1;\n }\n }\n if ($res != 1) {\n header('Location:' . CARGAR_VENTAS['url'] . '?r=2');\n return;\n }\n header('Location:' . GENERAR_REPORTE['url'] . '?r=1');\n fclose($file);\n }", "public function import() {\n if ($_SERVER['REQUEST_METHOD'] == 'POST') {\n if ($_FILES['file0']['error'] == 0) {\n $data = yaml_parse_file($_FILES['file0']['tmp_name']);\n \n $SlideList = new SlideList;\n $SlideList->deleteAll();\n $Step = new Step;\n $Step->deleteAll();\n $Page = new Page;\n $Page->deleteAll();\n \n $result = array();\n \n foreach($data['steps'] as $step) {\n $slides = $step['_slides'];\n unset($step['_slides']);\n $Step->create($step);\n $result[] = \"Created step {$step['title']}\";\n foreach($slides as $slide) {\n $SlideList->create($slide);\n $result[] = \"Created slide {$slide['title']}\";\n }\n }\n foreach($data['pages'] as $page) {\n $Page->create($page);\n $result[] = \"Created page {$page['title']}\";\n }\n $this->set('result', $result);\n } else {\n $this->set('result', 'Upload failed');\n }\n }\n }", "function marquepages_importer_delicious($chemin, $id_rubrique){\n\tglobal $mp_xml_profondeur, $mp_id_rubrique;\n\t$mp_xml_profondeur = array();\n\t$mp_id_rubrique = $id_rubrique;\n\t$retours = array();\n\t\n\t$xml_parser = xml_parser_create();\n\txml_set_element_handler($xml_parser, \"marquepages_importer_delicious_debut\", \"marquepages_importer_delicious_fin\");\n\t\n\tif (!($flux_xml = fopen($chemin, \"r\")))\n\t\t$retours['message_erreur'] = _T('marquepages:erreur_importation');\n\t\n\twhile ($data = fread($flux_xml, 4096)) {\n\t\tif (!xml_parse($xml_parser, $data, feof($flux_xml))) {\n\t\t\t$retours['message_erreur'] = \n\t\t\t\t'Erreur XML :'\n\t\t\t\t. xml_error_string(xml_get_error_code($xml_parser))\n\t\t\t\t. 'à la ligne '\n\t\t\t\t. xml_get_current_line_number($xml_parser);\n\t\t}\n\t}\n xml_parser_free($xml_parser);\n \n if (!$retours['message_erreur'])\n\t\t$retours['message_ok'] = _T('marquepages:erreur_importation_ok');\n\t\n\treturn $retours;\n}", "function mmir_importMetas()\n{\n\n mmir_exportMetas(true); // isBackup à true.\n\n\n // Then we read the CSV file\n\n $uploadedFile = wp_handle_upload($_FILES['field__import'], array('test_form' => false));\n if ($uploadedFile && !isset($uploadedFile['error'])) {\n // No error\n $imported_CSV = fopen($uploadedFile['file'], 'r');\n $header = fgetcsv($imported_CSV, 1024, ';');\n while (!feof($imported_CSV)) {\n $line = fgetcsv($imported_CSV, 1024, ';');\n if (count($line) < 4 && $line) {\n throw new Exception('CSV file is not formatted properly.');\n } else {\n $post_id = $line[0] ?? '';\n $post_meta_title = $line[2] ?? '';\n $post_meta_desc = $line[3] ?? '';\n\n if (!empty($post_id)) {\n update_post_meta($post_id, '_yoast_wpseo_title', $post_meta_title);\n update_post_meta($post_id, '_yoast_wpseo_metadesc', $post_meta_desc);\n echo '<div class=\"import__processed\">Post ID ' . $post_id . ' processed' . '</div>';\n }\n }\n }\n } else {\n // Eroor\n throw new Exception('Upload failed.');\n }\n}", "public function reemplazarPartes()\n\t{\n\t\t$partes = $this->pagina->obtenerPartes();\n\t\tforeach($partes as $etiqueta => $plantilla)\n\t\t{\n\t\t\t$contenidoPlantilla = file_get_contents($plantilla['plantilla']);\n\t\t\t$etiquetas = array_keys($plantilla['reemplazo']);\n\t\t\t$nuevasEtiquetas = array();\n\t\t\tforeach ($etiquetas as $etiq)\n\t\t\t{\n\t\t\t\t$nuevasEtiquetas[] = '{'.$etiq.'}';\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$valores = array_values($plantilla['reemplazo']);\n\t\t\t$contenidoPlantilla = str_replace($nuevasEtiquetas, $valores, $contenidoPlantilla);\n\t\t\t$nuevoContenido = str_replace('{'.$etiqueta.'}',$contenidoPlantilla,$this->pagina->obtenerContenido());\n\t\t\t$this->pagina->fijarContenido($nuevoContenido);\t\t\t\n\t\t}\n\t}", "function add_tt_1_edar_alkes_import() {\n//\t\tif (! $this->get_permission('fill_this')) return $this->intruder();\n\t\tglobal $_POST, $adodb, $ses;\n\t\t$record = $_POST;\n\t\tforeach ($record as $k => $v) $record[$k] = trim($v);\n\t\t\n\t\t$rsx = $adodb->Execute(\"SELECT * FROM tt_1_edar_alkes_import ORDER by no_tt DESC LIMIT 1\");\n\t\t$tahun_data = date('Y',$rsx->fields['date_insert']);\n\t\t$tahun_now = date('Y');\n\t\t\n\n\t\tif($rsx->fields['urut_no_tt'] == ''){\n\t\t\t$urut_no_tt = 1;\n\t\t}else{\n\t\t\tif($tahun_data == $tahun_now){\n\t\t\t\t$urut_no_tt = $rsx->fields['urut_no_tt'] + 1;\n\t\t\t}else{\n\t\t\t\t$urut_no_tt = 1;\n\t\t\t}\n\t\t}\n\n\t\t$sqly = \"SELECT\n\t\t\tsubdit\n\t\tFROM\n\t\t\tsubdit\n\t\tWHERE\n\t\t\tid_subdit = '\".$_POST['kode_subdit'].\"'\n\t\t\";\n\t\t//print $sqly;\n\t\t$lastno = $rsx->fields['urut_no_tt'];\n\t\t$lastno = $lastno[2].$lastno[3].$lastno[4].$lastno[5].$lastno[6];\n\t\t$lastno = intval($lastno);\n\t\t$lastno = $lastno + $urut_no_tt;\n\n\t\t$rsy = $adodb->Execute($sqly);\n\t\t$subdit = $rsy->fields['subdit'];\n\t\t$a = date('d-m/Y');\n\t\t$no = str_pad($lastno, 5, \"0\", STR_PAD_LEFT);\n\t\t$urut_no_tt = $subdit.\"/\".$no.\"/\".$a;\n\n \t\t$record['urut_no_tt'] = $urut_no_tt;\n\n\n\t\t$rs = $adodb->Execute(\"SELECT * FROM tt_1_edar_alkes_import WHERE no_tt = '{$record['oldpkvalue']}'\");\n\t\tif ($rs && ! $rs->EOF) {\n\t\t\t$adodb->Execute($adodb->GetUpdateSQL($rs, $record, 1));\n\t\t\t$st = \"Updated\";\n\t\t} else {\n\t\t\t$record['insert_by'] = $ses->loginid;\n\t\t\t$record['date_insert'] = time();\n\t\t\t$rs = $adodb->Execute(\"SELECT * FROM tt_1_edar_alkes_import WHERE no_tt = NULL\");\n\t\t\t$adodb->Execute($adodb->GetInsertSQL($rs, $record));\n\t\t\t$st = \"Added\";\n\t\t}\n\t\t//print_r($st);exit();\n\t\t$status = \"Successfull $st '<b>{$record['no_tt']}</b>'\";\n\t\t$this->log($status);\n\t\t\n\t\t$_block = new block();\n\t\t$_block->set_config('title', 'Status');\n\t\t$_block->set_config('width', \"90%\");\n\t\t$_block->parse(array(\"*\".$status));\n\t\treturn $_block->get_str();\n\t}", "public function saveFields()\n {\n $nome_arquivo = $this->arquivo;\n $array_insert = $this->readFile();\n\n if(!empty($array_insert))\n {\n array_shift($array_insert);\n Yii::$app->db->createCommand()->batchInsert(\n 'alimentos', \n ['descricao', 'medida_caseira', 'calorias', 'grupo_id'],\n $array_insert\n )->execute();\n\n $this->total_insert = count($array_insert);\n }\n\n }", "public function cargar_archivo_wordpress(){\n\n //obtenemos es contenido del archivo xml que hemos subido\n $contenido_archivo = file_get_contents($_FILES['archivo']['tmp_name']);\n\n //cargamos la informacion del archivo en un objeto SimpleXMLElement\n $xml = simplexml_load_string($contenido_archivo);\n\n //declaramos el array de entradas\n $entradas = array();\n\n //recoremos los elementos del objeto SimpleXMLElement que representa un articulo\n foreach($xml->channel->item as $item)\n {\n //declaramos los array para categoria y etiquetas\n $categorias = array();\n $etiquetas = array();\n\n //recoremos los elementos del objeto SimpleXMLElement que representa una categoria o etiqueta (category)\n foreach($item->category as $category)\n {\n //recogemos las caterias del articulo\n if($category['nicename'] != \"uncategorized\" && $category['domain'] == \"category\")\n {\n $categorias[] = $category;\n }\n\n //recogemos las etiquetas del articulo\n if($category['nicename'] != \"uncategorized\" && $category['domain'] == \"post_tag\")\n {\n $etiquetas[] = $category;\n }\n }\n\n //si el articulo no tiene categoria, los guardamo como null\n if(!isset($categorias[0])){\n $categorias[0] = NULL;\n }\n\n //ejecutamos los archivos de configuracion de los elemento xmlns del archivo xml\n $content = $item->children('http://purl.org/rss/1.0/modules/content/');\n $excerpt = $item->children('http://wordpress.org/export/1.2/excerpt/');\n $wp = $item->children('http://wordpress.org/export/1.2/');\n\n //obtenemos la fecha y hora de la publicacion del articulo\n $publicacion = explode(\" \",$wp->post_date);\n\n //cambiamos el contenido de elementos [nombre atributos=value][/nombre], en formato html \n $contenido = html_entity_decode($content->encoded);\n $contenido = str_replace('[', '<',$contenido);\n $contenido = str_replace(']', '>',$contenido);\n\n //creamos por cada articulo del archivo xml un entrada tipo Medssocial\n $entradas[] = array(\n \"titulo\"=>html_entity_decode($item->title),\n \"extracto_texto\"=>html_entity_decode($excerpt->encoded),\n \"contenido\"=>$contenido,\n \"publicacion\"=>$publicacion[0],\n \"categoria\"=>html_entity_decode($categorias[0]),\n \"etiquetas\"=>implode(\",\", $etiquetas),\n \"titulo_url\"=>normalizar_string($item->title)\n );\n }\n\n return $entradas;\n }", "function importer_spip_partenaires_types() {\n\n\t######## VERIFIEZ LE NOM DE LA TABLE D'INSERTION ###########\n\t$table = 'spip_partenaires_types';\n\n\t// nom_du_champ_source => nom_du_champ_destination\n\t// mettre vide la destination ou supprimer la ligne permet de ne pas importer la colonne.\n\t$correspondances = array(\n\t\t'id_type' => 'id_type',\n\t\t'titre' => 'titre',\n\t\t'descriptif' => 'descriptif',\n\t\t'maj' => 'maj',\n\t);\n\n\t// transposer les donnees dans la nouvelle structure\n\t$inserts = array();\n\tlist($cles, $valeurs) = donnees_spip_partenaires_types();\n\t// on remet les noms des cles dans le tableau de valeur\n\t// en s'assurant de leur correspondance au passage\n\tif (is_array($valeurs)) {\n\t\tforeach ($valeurs as $v) {\n\t\t\t$i = array();\n\t\t\tforeach ($v as $k => $valeur) {\n\t\t\t\t$cle = $cles[$k];\n\t\t\t\tif (isset($correspondances[$cle]) and $correspondances[$cle]) {\n\t\t\t\t\t$i[ $correspondances[$cle] ] = $valeur;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$inserts[] = $i;\n\t\t}\n\t\tunset($valeurs);\n\n\t\t// inserer les donnees en base.\n\t\t$nb_inseres = 0;\n\t\t// ne pas reimporter ceux deja la (en cas de timeout)\n\t\t$nb_deja_la = sql_countsel($table);\n\t\t$inserts = array_slice($inserts, $nb_deja_la);\n\t\t$nb_a_inserer = count($inserts);\n\t\t// on decoupe en petit bout (pour reprise sur timeout)\n\t\t$inserts = array_chunk($inserts, 100);\n\t\tforeach ($inserts as $i) {\n\t\t\tsql_insertq_multi($table, $i);\n\t\t\t$nb_inseres += count($i);\n\t\t\t// serie_alter() relancera la fonction jusqu'a ce que l'on sorte sans timeout.\n\t\t\tif (time() >= _TIME_OUT) {\n\t\t\t\t// on ecrit un gentil message pour suivre l'avancement.\n\t\t\t\techo \"<br />Insertion dans $table relanc&eacute;e : \";\n\t\t\t\techo \"<br />- $nb_deja_la &eacute;taient d&eacute;j&agrave; l&agrave;\";\n\t\t\t\techo \"<br />- $nb_inseres ont &eacute;t&eacute; ins&eacute;r&eacute;s.\";\n\t\t\t\t$a_faire = $nb_a_inserer - $nb_inseres;\n\t\t\t\techo \"<br />- $a_faire &agrave; faire.\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}", "function cl_diverimporta() {\n //classes dos rotulos dos campos\n $this->rotulo = new rotulo(\"diverimporta\");\n $this->pagina_retorno = basename($GLOBALS[\"HTTP_SERVER_VARS\"][\"PHP_SELF\"]);\n }", "public function importar_archivo(Request $request){\n\n //datos comunes de las vistas\n $datos_vista = $this->cargar_datos();\n \n //obtenemos el array de imagenes que define el tipo de importacion\n $arr_imagenes_importar = $this->imagenes_importar_entradas();\n\n //si el request que recibimos no se haya entre el array anterior, volvemos a la vista inicial\n if(!isset($arr_imagenes_importar[$request->tipo])){\n return redirect()->route('tipo-importacion');\n }\n\n //recogemos el tipo de archivo\n $datos_vista['tipo-importacion'] = $request->tipo;\n\n //definimos el paso en que nos encontramos\n $datos_vista['paso'] = 'importar-archivo';\n\n return return_vistas('blogs.importar-entradas', $datos_vista);\n\n }", "private function saveArticleAssets() {\n foreach ($this->files as $url => $path) {\n $contents = file_get_contents($path);\n \\Drupal::service('file_system')->saveData($contents, $this->entityDirectory . '/' . basename($url));\n }\n }", "function registra($title, $text){\n global $BLOGFILE;\n /* \n * Legge il contenuto di un file e lo\n * restituisce in un array i cui elementi sono\n * le righe del file.\n */\n $content = file($BLOGFILE);\n /* \n * Divide la stringa in porzioni dove è presente\n * la stringa di separazione e restituisce le parti\n * all'interno di un array.\n */ \n $penultimo = explode(\"#\", $content[0]);\n $ultimo = $penultimo[0] + 1;\n $fp = fopen($BLOGFILE, \"w\");\n $title = rendiConforme($title);\n $text = rendiConforme($text);\n \n // Formattazione post\n $post = $ultimo \n . \"#\" . date(\"Y-m-d, G:i\") \n . \"#\" . $title \n . \"#\" . $text . \"\\n\";\n \n fwrite($fp, $post);\n // Se sono presenti post precedenti vengono riscritti\n if(count($content)>0){\n foreach ($content as $post) {\n fwrite($fp, $post);\n }\n }\n fclose($fp);\n }", "public function copiaArquivosImportantes(){\n\t\t$copiador = new Copiador();\n\t\t$nomeDoSite = $this->software->getNome();\n\t\t\n\t\t\n\t\t\n\t\t$caminho_inicial = 'class/appado/TCriteria.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TCriteria.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\t\n\t\t$caminho_inicial = 'class/appado/TExpression.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TExpression.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t$caminho_inicial ='class/appado/TFilter.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TFilter.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\n\t\t$caminho_inicial = 'class/appado/TSqlInstruction.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TSqlInstruction.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\n\t\t$caminho_inicial = 'class/appado/TSqlInsert.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TSqlInsert.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\n\t\t$caminho_inicial = 'class/appado/TSqlSelect.class.php';\n\t\t$caminho_final = 'sistemasphp/'.$nomeDoSite.'/class/appado/TSqlSelect.class.php';\n\t\t$copiador->setCaminho_inicial($caminho_inicial);\n\t\t$copiador->setCaminho_final($caminho_final);\n\t\t$copiador->copiarArquivo();\n\t\t\n\t\t\n\t}", "function importIt()\n{\n\t// Disable a time limit\n\tset_time_limit(0);\n\n\t// Require some Wordpress core files for processing images\n\trequire_once(ABSPATH . 'wp-admin/includes/media.php');\n\trequire_once(ABSPATH . 'wp-admin/includes/file.php');\n\trequire_once(ABSPATH . 'wp-admin/includes/image.php');\n\n\t// Download and parse the xml\n\t$xml = simplexml_load_file(file_get_contents('https://www.thelivewelldirectory.com/api/search?apikey=X59WU602uf&Keywords=Wellbeing-Calm'));\n\n\t// Succesfully loaded?\n\tif($xml !== FALSE){\n\n\t\t// First remove all previous imported posts\n\t\t$currentPosts = get_posts(array( \n\t\t\t'post_type' \t\t=> 'activities', // Or \"page\" or some custom post type\n\t\t\t'post_status' \t\t=> 'publish',\n\t\t\t'meta_key'\t\t\t=> 'imported', // Our post options to determined\n\t\t\t'posts_per_page' \t=> 1000 // Just to make sure we've got all our posts, the default is just 5\n\t\t));\n\n\t\t// Loop through them\n\t\tforeach($currentPosts as $post){\n\n\t\t\t// Get the featured image id\n\t\t\tif($thumbId = get_post_meta($post->ID,'_thumbnail_id',true)){\n\n\t\t\t\t// Remove the featured image\n\t\t\t\twp_delete_attachment($thumbId,true);\n\t\t\t}\n\n\t\t\t// Remove the post\n\t\t\twp_delete_post( $post->ID, true);\n\t\t}\n\n\t\t// Loop through some items in the xml\n\t\tforeach($xml->item as $item){\n\n\t\t\t// Let's start with creating the post itself\n\t\t\t$postCreated = array(\n\t\t\t\t'post_title' \t=> $item->Service,\n\t\t\t\t'post_content' \t=> $item->Description,\n\t\t\t\t'post_excerpt' \t=> $item->Organisation,\n\t\t\t\t'post_status' \t=> 'publish',\n\t\t\t\t'post_type' \t=> 'activities', // Or \"page\" or some custom post type\n\t\t\t);\n\n\t\t\t// Get the increment id from the inserted post\n\t\t\t$postInsertId = wp_insert_post( $postCreated );\n\n\t\t\t// Our custom post options, for now only some meta's for the\n\t\t\t// Yoast SEO plugin and a \"flag\" to determined if a\n\t\t\t// post was imported or not\n\t\t\t$postOptions = array(\n\t\t\t\t'imported'\t\t\t\t=> true\n\t\t\t);\n\n\t\t\t// Loop through the post options\n\t\t\tforeach($postOptions as $key=>$value){\n\n\t\t\t\t// Add the post options\n\t\t\t\tupdate_post_meta($postInsertId,$key,$value);\n\t\t\t}\n\n\t\t\t// This is a little trick to \"catch\" the image id\n\t\t\t// Attach/upload the \"sideloaded\" image\n\t\t\t// And remove the little trick\n\t\t\t// add_action('add_attachment','featuredImageTrick');\n\t\t\t// media_sideload_image($item->image, $postInsertId, $item->title);\n\t\t\t// remove_action('add_attachment','featuredImageTrick');\n\t\t}\n\t}\n}", "public function importe_p(){ \t\t\r\n\t\t\t\t$sql = \"UPDATE traspasos SET pagado = '0' WHERE `folio` =\".$_POST['folio'];\r\n\t\t\t\treturn $this->query($sql);\r\n\t\t\t}", "public function postImport() {\n\n }", "public function importImagesAllContent()\n {\n $all = Content::find()\n ->where(['section_id' => $this->sectionId])\n ->all();\n foreach ($all as $one) {\n $one->save();\n }\n\n }" ]
[ "0.6621637", "0.6537881", "0.64851856", "0.64481", "0.64218026", "0.63572854", "0.62269014", "0.60944813", "0.60361147", "0.60322857", "0.6029891", "0.6014923", "0.59672105", "0.59593683", "0.59251964", "0.5841532", "0.58359647", "0.579075", "0.5749433", "0.5745288", "0.57107925", "0.563249", "0.5610254", "0.557405", "0.5571154", "0.5561879", "0.55568546", "0.5551066", "0.5549444", "0.5547563" ]
0.6800692
0
[cargar_archivo_wordpress obtenemos una array de entradas tipo Medssocial desde un archivo XML de Wordpress]
public function cargar_archivo_wordpress(){ //obtenemos es contenido del archivo xml que hemos subido $contenido_archivo = file_get_contents($_FILES['archivo']['tmp_name']); //cargamos la informacion del archivo en un objeto SimpleXMLElement $xml = simplexml_load_string($contenido_archivo); //declaramos el array de entradas $entradas = array(); //recoremos los elementos del objeto SimpleXMLElement que representa un articulo foreach($xml->channel->item as $item) { //declaramos los array para categoria y etiquetas $categorias = array(); $etiquetas = array(); //recoremos los elementos del objeto SimpleXMLElement que representa una categoria o etiqueta (category) foreach($item->category as $category) { //recogemos las caterias del articulo if($category['nicename'] != "uncategorized" && $category['domain'] == "category") { $categorias[] = $category; } //recogemos las etiquetas del articulo if($category['nicename'] != "uncategorized" && $category['domain'] == "post_tag") { $etiquetas[] = $category; } } //si el articulo no tiene categoria, los guardamo como null if(!isset($categorias[0])){ $categorias[0] = NULL; } //ejecutamos los archivos de configuracion de los elemento xmlns del archivo xml $content = $item->children('http://purl.org/rss/1.0/modules/content/'); $excerpt = $item->children('http://wordpress.org/export/1.2/excerpt/'); $wp = $item->children('http://wordpress.org/export/1.2/'); //obtenemos la fecha y hora de la publicacion del articulo $publicacion = explode(" ",$wp->post_date); //cambiamos el contenido de elementos [nombre atributos=value][/nombre], en formato html $contenido = html_entity_decode($content->encoded); $contenido = str_replace('[', '<',$contenido); $contenido = str_replace(']', '>',$contenido); //creamos por cada articulo del archivo xml un entrada tipo Medssocial $entradas[] = array( "titulo"=>html_entity_decode($item->title), "extracto_texto"=>html_entity_decode($excerpt->encoded), "contenido"=>$contenido, "publicacion"=>$publicacion[0], "categoria"=>html_entity_decode($categorias[0]), "etiquetas"=>implode(",", $etiquetas), "titulo_url"=>normalizar_string($item->title) ); } return $entradas; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function initializeMedias(){\n\n $node = $this->getNode();\n $node -> loadedmedias = true;\n $node -> lkstatus = @$node -> field_kamp_status[\"und\"][0][\"value\"];\n $node -> plzaccess = KampagnenAccess::has($this);\n $node -> kid = $node -> sid = @$node -> field_sid[\"und\"][0][\"value\"];\n\n $medien = [];\n\n $result = db_query('SELECT field_medium_node_nid as nid, entity_id, entity_type '\n . 'FROM {field_data_field_medium_node} '\n . \"WHERE entity_type='medium' AND field_medium_node_nid = :nid\", array(':nid' => $this -> node -> nid));\n foreach ($result as $record) {\n $medien[] = entity_load_single($record -> entity_type, $record -> entity_id);\n }\n\n $medien_print = array();\n $medien_online = array();\n\n foreach($medien as $media){\n $test = \\_lk_get_medientyp_print_or_online($media->field_medium_typ['und'][0]['tid']);\n $media -> media_type = $test;\n\n if($test == 'print'){\n $medien_print[] = $media;\n }\n else {\n $medien_online[] = $media;\n }\n }\n\n foreach ($medien_online as $medium){\n $medien_print[] = $medium;\n }\n\n $node -> medien = $medien_print;\n }", "public function makeContentImagesLocal()\n\t{\n\t\t$this->feed_item->image_count=0;\n\n\t\t$user_id=$this->pluginOptions['post_author'];\n\t\t$post_id=$this->feed_item->post_id;\n\t\t$this->trace($this->feed->url.\" ==> makeContentImagesLocal\");\n\n\t\tif(strlen($this->feed_item->content)<=2) return;\n\n\t\t$this->pre_loadHTML();\n\n\t\t$imgs = $this->dom->getElementsByTagName('img');\n\n\t\tif(get_class($imgs)!='DOMNodeList') return;\n\n\t\t$length = $imgs->length;\n\t\t$featured_image=false;\n\t\tfor ($i = $length-1; $i >=0; $i--)\n\t\t{\n\t\t\t$img=$imgs->item($i);\n\n\t\t\t$found=false;\n\t\t\t$image=[\n\t\t\t'src'=>(string)$img->getAttribute('src'),\n\t\t\t'alt'=>(string)$img->getAttribute('alt'),\n\t\t\t'title'=>(string)$img->getAttribute('title')\n\t\t\t];\n\n\t\t\t$img->removeAttribute('width');\n\t\t\t$img->removeAttribute('height');\n\n\t\t\tif(strlen($image['src'])<0&&strlen($image['src'])>255)\n\t\t\t\tcontinue;\n\n\t\t\tif(substr($image['src'],0,2)=='//')\n\t\t\t{\n\t\t\t\t$image['src']=\"http:\".$image['src'];\n\t\t\t}\n\n\t\t\t/* */\n\t\t\t$tmp = download_url( $image['src'] );\n\n\t\t\t$desc = $image['alt']==''?$image['title']:$image['alt'];\n\n\t\t\t$file_array = [];\n\n\t\t\tpreg_match('/[^\\?]+\\.(jpg|jpe|jpeg|gif|png)/i', $image['src'], $matches);\n\t\t\tif(count($matches)==0)\n\t\t\t{\n\t\t\t\t$file_array['name'] = $image['src'];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$file_array['name'] = basename($matches[0]);\n\t\t\t}\n\n\t\t\t$file_array['tmp_name'] = $tmp;\n\n\t\t\tif ( is_wp_error( $tmp ) ) {\n\t\t\t\t@unlink($file_array['tmp_name']);\n\t\t\t\t$file_array['tmp_name'] = '';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$cat_ids=$this->getMultipleCategories();\n\t\t\t\t$post_array = [\n\t\t\t\t'post_author' => $user_id, \n\t\t\t\t'post_date' => date(\"Y-m-d H:i:s\",strtotime($this->feed_item->published_at)),\n\t\t\t\t'post_category' => $cat_ids\n\t\t\t\t];\n\n\t\t\t\t$media_id = media_handle_sideload( $file_array, $post_id, $desc,$post_array );\n\n\t\t\t\tif ( is_wp_error($media_id) ) {\n\t\t\t\t\t/* image couldn' be found -- will be removed later */\n\t\t\t\t\t@unlink($file_array['tmp_name']);\n\t\t\t\t\t//$img->removeAttribute('src');\n\t\t\t\t\t$this->trace($image['src'].\" error: \".$media_id->get_error_messages( )[0]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t/* image is valid and local */\n\t\t\t\t\t$image['url'] = wp_get_attachment_url( $media_id );\n\n\t\t\t\t\t$min_width=$this->pluginOptions['min_width'];\n\t\t\t\t\t$min_height=$this->pluginOptions['min_height'];\n\n\t\t\t\t\tlist($width, $height)=getimagesize($image['url']);\n\t\t\t\t\t$image['width']=$width;\n\t\t\t\t\t$image['height']=$height;\n\n\t\t\t\t\t/* ignore unless over a certain width/height */\n\t\t\t\t\tif($width>$min_width&&$height>$min_height)\n\t\t\t\t\t{\n\t\t\t\t\t\t/* replace old url with new url */\n\t\t\t\t\t\t$img->setAttribute('src',$image['url']);\n\n\t\t\t\t\t\t$class=$img->getAttribute('class');\n\t\t\t\t\t\t$class=explode(\" \",trim($class));\n\t\t\t\t\t\t$class[]=\"loremblogum-responsive\";\n\t\t\t\t\t\t$class=trim(implode(\" \",$class));\n\t\t\t\t\t\t$img->setAttribute('class',$class);\n\n\t\t\t\t\t\t$this->feed_item->image_count++;\n\t\t\t\t\t\t$this->feed->image_count++;\n\t\t\t\t\t\t$hash=md5($image['src']);\n\n\t\t\t\t\t\t$this->feed->log['feed_items_images'][$hash]=(object)[\n\t\t\t\t\t\t'url'=>$this->feed_item->url,\n\t\t\t\t\t\t'published_at'=>$this->feed_item->published_at,\n\t\t\t\t\t\t'image_no'=>$this->feed_item->image_count,\n\t\t\t\t\t\t'image_url'=>$image['url'],\n\t\t\t\t\t\t'image_src'=>$image['src']\n\t\t\t\t\t\t];\n\n\t\t\t\t\t\t/* add a featured image when the first image is found */\n\t\t\t\t\t\tif($featured_image===false&&$this->pluginOptions['featured_image']=='Yes')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t/* */\n\t\t\t\t\t\t\tset_post_thumbnail( $post_id, $media_id );\n\t\t\t\t\t\t\t$featured_image=true;\n\n\t\t\t\t\t\t\t/* */\n\t\t\t\t\t\t\t$img->parentNode->removeChild($img);\n\t\t\t\t\t\t}\t\t\n\n\t\t\t\t\t\t/* */\n\t\t\t\t\t\t$found=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t/* if we didn't get a local copy, remove reference */\n\t\t\tif($found===false)\n\t\t\t{\n\t\t\t\t/* replace old url with blank */\n\t\t\t\t$img->parentNode->removeChild($img);\n\t\t\t}\n\t\t}\n\t\t$this->post_saveHTML();\n\t}", "function get_social_media_links(){\n \n $social_array = get_transient_array('social_media_links', 'fetch_social_media_links', 'auto');\n \n return $social_array;\n \n}", "function importIt()\n{\n\t// Disable a time limit\n\tset_time_limit(0);\n\n\t// Require some Wordpress core files for processing images\n\trequire_once(ABSPATH . 'wp-admin/includes/media.php');\n\trequire_once(ABSPATH . 'wp-admin/includes/file.php');\n\trequire_once(ABSPATH . 'wp-admin/includes/image.php');\n\n\t// Download and parse the xml\n\t$xml = simplexml_load_file(file_get_contents('https://www.thelivewelldirectory.com/api/search?apikey=X59WU602uf&Keywords=Wellbeing-Calm'));\n\n\t// Succesfully loaded?\n\tif($xml !== FALSE){\n\n\t\t// First remove all previous imported posts\n\t\t$currentPosts = get_posts(array( \n\t\t\t'post_type' \t\t=> 'activities', // Or \"page\" or some custom post type\n\t\t\t'post_status' \t\t=> 'publish',\n\t\t\t'meta_key'\t\t\t=> 'imported', // Our post options to determined\n\t\t\t'posts_per_page' \t=> 1000 // Just to make sure we've got all our posts, the default is just 5\n\t\t));\n\n\t\t// Loop through them\n\t\tforeach($currentPosts as $post){\n\n\t\t\t// Get the featured image id\n\t\t\tif($thumbId = get_post_meta($post->ID,'_thumbnail_id',true)){\n\n\t\t\t\t// Remove the featured image\n\t\t\t\twp_delete_attachment($thumbId,true);\n\t\t\t}\n\n\t\t\t// Remove the post\n\t\t\twp_delete_post( $post->ID, true);\n\t\t}\n\n\t\t// Loop through some items in the xml\n\t\tforeach($xml->item as $item){\n\n\t\t\t// Let's start with creating the post itself\n\t\t\t$postCreated = array(\n\t\t\t\t'post_title' \t=> $item->Service,\n\t\t\t\t'post_content' \t=> $item->Description,\n\t\t\t\t'post_excerpt' \t=> $item->Organisation,\n\t\t\t\t'post_status' \t=> 'publish',\n\t\t\t\t'post_type' \t=> 'activities', // Or \"page\" or some custom post type\n\t\t\t);\n\n\t\t\t// Get the increment id from the inserted post\n\t\t\t$postInsertId = wp_insert_post( $postCreated );\n\n\t\t\t// Our custom post options, for now only some meta's for the\n\t\t\t// Yoast SEO plugin and a \"flag\" to determined if a\n\t\t\t// post was imported or not\n\t\t\t$postOptions = array(\n\t\t\t\t'imported'\t\t\t\t=> true\n\t\t\t);\n\n\t\t\t// Loop through the post options\n\t\t\tforeach($postOptions as $key=>$value){\n\n\t\t\t\t// Add the post options\n\t\t\t\tupdate_post_meta($postInsertId,$key,$value);\n\t\t\t}\n\n\t\t\t// This is a little trick to \"catch\" the image id\n\t\t\t// Attach/upload the \"sideloaded\" image\n\t\t\t// And remove the little trick\n\t\t\t// add_action('add_attachment','featuredImageTrick');\n\t\t\t// media_sideload_image($item->image, $postInsertId, $item->title);\n\t\t\t// remove_action('add_attachment','featuredImageTrick');\n\t\t}\n\t}\n}", "function themo_import_post_meta( $postmeta, $post_id, $post ) {\r\n $find = \"http://www.pixelglow.ro/themes/planuswp-v2.1/wp-content/uploads/\"; // Search url\r\n $upload_dir = wp_upload_dir(); // Replace URL\r\n $replace = $upload_dir['baseurl']; // upload url of the local site.\r\n\r\n // Watch out for newlines inside of serialized data when importing from XML, they will break the import.\r\n // I've found that the XML leaves a discrepancy of how many chars are in the serialized string. I add 1 extra for each line break.\r\n $find2 = \"\\n\"; // look for newline\r\n $replace2 = \"\\n \"; // replace newline + 1 extra char (Hack you say? Yes I am aware.)\r\n\r\n // Multidimensional array loop\r\n foreach ($postmeta as $key => $value){\r\n foreach ($value as $sub_key => $sub_value){\r\n\r\n // If this is serialized data we need to unserialize to find / replace.\r\n if (is_serialized($sub_value)){\r\n $reserialize = true;\r\n $sub_value = str_replace($find2, $replace2, $sub_value); // Clean up\r\n $sub_value = mb_unserialize($sub_value); // unserialize\r\n }else{\r\n $reserialize = false;\r\n }\r\n\r\n $sub_value = str_replace($find, $replace, $sub_value); // Find / replace value 1\r\n\r\n if(is_array($sub_value)){ // We may nned to go even deeper...\r\n\r\n foreach ($sub_value as $sub_sub_key => $sub_sub_value){ \r\n\r\n $sub_value[$sub_sub_key] = str_replace($find, $replace, $sub_sub_value); // Find and replace value 1\r\n $sub_value[$sub_sub_key] = str_replace($find2, $replace2, $sub_value[$sub_sub_key]); // Find and replace value 2\r\n\r\n if(is_array($sub_sub_value)){ // We may nned to go even DEEPER..!\r\n foreach ($sub_sub_value as $sub_sub_sub_key => $sub_sub_sub_value){\r\n\r\n $sub_value[$sub_sub_key][$sub_sub_sub_key] = str_replace($find, $replace, $sub_sub_sub_value); // Find and replace value 1\r\n $sub_value[$sub_sub_key][$sub_sub_sub_key] = str_replace($find2, $replace2, $sub_value[$sub_sub_key][$sub_sub_sub_key]); // Find and replace value 2\r\n\r\n\r\n }\r\n } \r\n }\r\n }\r\n\r\n // If we unserialized then serialize back up again.\r\n if($reserialize){\r\n $value[$sub_key] = serialize($sub_value);\r\n }else{\r\n $value[$sub_key] = $sub_value;\r\n }\r\n }\r\n $postmeta[$key] = $value;\r\n }\r\n\r\n return $postmeta;\r\n}", "static function get_static_posts() {\n\n if( BlogPad::has_setting('static_posts_dir') ) {\n\n $dir = BlogPad::get_setting('base').'/'.BlogPad::get_setting('static_posts_dir');\n\n $opendir = opendir($dir);\n\n $posts = array();\n\n while( $static_post = readdir($opendir) ) {\n\n if( preg_match('/\\.bpp$/', $static_post ) ) {\n\n // Parsing the post will return an array by default.\n $posts[ count( $posts ) ] = BP_Parser::parse_bpp( $dir.'/'.$static_post);\n\n $posts[ count( $posts ) - 1 ] = array_map('stripslashes', $posts[ count( $posts ) - 1 ]); \n\n // The slug will be the name of the static post file. Remove the .bpp extension.\n $posts[ count( $posts ) - 1]['slug'] = preg_replace('/\\.bpp$/', '', $static_post);\n\n // Serialize categories if they can be exploded by commas, else add the category to an array and then serialize.\n $posts[ count( $posts ) - 1]['categories'] = BlogPad::list_to_ser($posts[ count( $posts ) - 1]['categories']);\n\n // Remove html from the title and trim it as well.\n $posts[ count( $posts ) - 1]['title'] = trim( strip_tags( $posts[ count( $posts ) - 1]['title'] ));\n\n // Add an excerpt key\n $posts[ count( $posts ) - 1]['excerpt'] = Parsedown::instance()->parse( substr($posts[ count( $posts ) - 1]['post'], 0, 200) ).( strlen($posts[ count( $posts ) - 1]['post']) > 200 ? '...': '');\n\n // Add when the post was updated using filemtime\n $posts[ count( $posts ) - 1]['updated'] = filemtime($dir.'/'.$static_post);\n\n // Additional space before the author's name can pose problems, thus rid them here.\n $posts[ count( $posts ) - 1]['author'] = trim( $posts[ count( $posts ) - 1]['author'] );\n\n } \n }\n\n return $posts;\n }\n\n }", "function aps_content_entry_media( ) {\n if (is_single())\n {\n //Comprobar si tengo que sobreescribir la featured image con un shortcode\n $featured_use_sc = get_post_meta( get_the_ID(), 'post_featured_as_shortcode', true);\n if ( $featured_use_sc && $featured_use_sc == 'yes' ) {\n $sc = get_post_meta( get_the_ID(), 'post_featured_shortcode', true);\n echo do_shortcode($sc);\n } else {\n aps_content_entry_media_normal();\n }\n\n }\n\n //Para el blog\n //puede ser imagen de proporcion natural, o imagen recortada, depende del tipo de blog\n //Algunos tipos de blogs requieren la imagen de proporcion natural\n //y otros una imagen recortada (list_m1, list_m2, list_m3, grid_1, grid_2, grid_3)\n else\n {\n global $aps_config;\n $tipo_blog = $aps_config['blog_layout'];\n\n //Tamaños predefinidos segun tipo de blog\n //Para el grid deberia variar el tamaño segun el num de cols\n $blogs_recortar = array(\n 'list_m1' => array('w'=>590,'h'=>295),\n 'list_m2' => array('w'=>590,'h'=>295),\n 'list_m3' => array('w'=>590,'h'=>300),\n 'grid_1' => array('w'=>440,'h'=>440),\n 'grid_2' => array('w'=>440,'h'=>290),\n 'grid_3' => array('w'=>290,'h'=>490),\n );\n\n //echo '<h1>Blog tipo: '.$tipo_blog.'</h1>';\n\n //Imagen para recortar\n if ( in_array( $tipo_blog, array_keys($blogs_recortar)) )\n {\n //echo '<h2>Imagen recortada</h2>';\n $width = $blogs_recortar[$tipo_blog]['w'];\n $height = $blogs_recortar[$tipo_blog]['h'];\n aps_content_entry_media_resized( $width, $height );\n }\n\n //Imagen sin recortar\n else\n {\n //echo '<h2>Imagen sinn recortar</h2>';\n aps_content_entry_media_normal();\n }\n }\n\n }", "function template_preprocess_social_media_post(array &$variables) {\n // Fetch OmaEntity Entity Object.\n $social_media_post = $variables['elements']['#social_media_post'];\n $social_media_type = $social_media_post->getType();\n $social_media_type_class = $social_media_type;\n // Change the class for youtube so it's not the default icon.\n if ($social_media_type === 'youtube') {\n $social_media_type_class = 'youtube-play';\n }\n\n $variables['social_media_type_class'] = $social_media_type_class;\n\n // Helpful $content variable for templates.\n foreach (Element::children($variables['elements']) as $key) {\n $variables['content'][$key] = $variables['elements'][$key];\n }\n}", "function extract_data($pages, $courseid, $lessonname, $modname) {\n // the slides are ugly broken xml. and the xml is broken... yeah...\n \n global $CFG;\n global $matches;\n\n $extratedpages = array();\n \n // directory for images\n make_mod_upload_directory($courseid); // make sure moddata is made\n make_upload_directory($courseid.'/moddata/'.$modname, false); // we store our images in a subfolder in here \n \n $imagedir = $CFG->dataroot.'/'.$courseid.'/moddata/'.$modname;\n \n if ($CFG->slasharguments) {\n $imagelink = $CFG->wwwroot.'/file.php/'.$courseid.'/moddata/'.$modname;\n } else {\n $imagelink = $CFG->wwwroot.'/file.php?file=/'.$courseid.'/moddata/'.$modname;\n }\n \n // try to make a unique subfolder to store the images\n $lessonname = str_replace(' ', '_', $lessonname); // get rid of spaces\n $i = 0;\n while(true) {\n if (!file_exists($imagedir.'/'.$lessonname.$i)) {\n // ok doesnt exist so make the directory and update our paths\n mkdir($imagedir.'/'.$lessonname.$i);\n $imagedir = $imagedir.'/'.$lessonname.$i;\n $imagelink = $imagelink.'/'.$lessonname.$i;\n break;\n }\n $i++;\n }\n \n foreach ($pages as $file => $content) {\n // to make life easier on our preg_match_alls, we strip out all tags except\n // for div and img (where our content is). We want div because sometimes we\n // can identify the content in the div based on the div's class\n \n $tags = '<div><img>'; // should also allow <b><i>\n $string = strip_tags($content,$tags);\n //echo s($string);\n\n $matches = array();\n // this will look for a non nested tag that is closed\n // want to allow <b><i>(maybe more) tags but when we do that\n // the preg_match messes up.\n preg_match_all(\"/(<([\\w]+)[^>]*>)([^<\\\\2>]*)(<\\/\\\\2>)/\", $string, $matches);\n //(<([\\w]+)[^>]*>)([^<\\\\2>]*)(<\\/\\\\2>) original pattern\n //(<(div+)[^>]*>)[^(<div*)](<\\/div>) work in progress\n\n $path_parts = pathinfo($file); \n $file = substr($path_parts['basename'], 0, strpos($path_parts['basename'], '.')); // get rid of the extension\n\n $imgs = array();\n // this preg matches all images\n preg_match_all(\"/<img[^>]*(src\\=\\\"(\".$file.\"\\_image[^>^\\\"]*)\\\"[^>]*)>/i\", $string, $imgs);\n\n // start building our page\n $page = new stdClass;\n $page->title = '';\n $page->contents = array();\n $page->images = array();\n $page->source = $path_parts['basename']; // need for book only\n\n // this foreach keeps the style intact. Found it doesn't help much. But if you want back uncomment\n // this foreach and uncomment the line with the comment imgstyle in it. Also need to comment out\n // the $page->images[]... line in the next foreach\n /*foreach ($imgs[1] as $img) { \n $page->images[] = '<img '.str_replace('src=\"', \"src=\\\"$imagelink/\", $img).' />';\n }*/\n foreach ($imgs[2] as $img) {\n copy($path_parts['dirname'].'/'.$img, $imagedir.'/'.$img);\n $page->images[] = \"<img src=\\\"$imagelink/$img\\\" title=\\\"$img\\\" />\"; // comment out this line if you are using the above foreach loop\n }\n for($i = 0; $i < count($matches[1]); $i++) { // go through all of our div matches\n \n $class = isolate_class($matches[1][$i]); // first step in isolating the class \n \n // check for any static classes\n switch ($class) {\n case 'T': // class T is used for Titles\n $page->title = $matches[3][$i];\n break;\n case 'B': // I would guess that all bullet lists would start with B then go to B1, B2, etc\n case 'B1': // B1-B4 are just insurance, should just hit B and all be taken care of\n case 'B2':\n case 'B3':\n case 'B4':\n $page->contents[] = build_list('<ul>', $i, 0); // this is a recursive function that will grab all the bullets and rebuild the list in html\n break;\n default:\n if ($matches[3][$i] != '&#13;') { // odd crap generated... sigh\n if (substr($matches[3][$i], 0, 1) == ':') { // check for leading : ... hate MS ...\n $page->contents[] = substr($matches[3][$i], 1); // get rid of :\n } else {\n $page->contents[] = $matches[3][$i];\n }\n }\n break;\n }\n }\n\n // add the page to the array;\n $extratedpages[] = $page;\n \n } // end $pages foreach loop\n \n return $extratedpages;\n}", "function mmir_exportMetas($isBackup = false)\n{\n $postTypesToExclude = array(\n 'revision',\n 'attachment',\n 'nav_menu_item',\n 'custom_css',\n 'customize_changeset',\n 'oembed_cache',\n 'acf-field-group',\n 'acf-field',\n 'messages'\n );\n $allPostTypes = get_post_types();\n\n foreach ($postTypesToExclude as $pte) {\n unset($allPostTypes[$pte]);\n }\n\n // Getting all posts for each post type\n\n $formattedPosts = array();\n\n foreach ($allPostTypes as $pte) {\n // Sorting by post types\n\n $formattedPosts[$pte] = array();\n\n // Getting all posts from current post type\n\n $args = array('post_type' => $pte, 'posts_per_page' => -1, 'orderby' => 'ID', 'order' => 'ASC');\n $allPostsOfPostType = get_posts($args);\n\n // Ordering and cleaning up\n\n foreach ($allPostsOfPostType as $singlePost) {\n\n $postitem = array();\n $postitem['id'] = $singlePost->ID;\n $postitem['url'] = get_permalink($postitem['id']);\n\n if (defined('WPSEO_VERSION')) {\n // Meta title\n $postitem['meta_title'] = get_post_meta($postitem['id'], '_yoast_wpseo_title');\n // Cleanup\n if (!empty($postitem['meta_title'])) {\n $postitem['meta_title'] = $postitem['meta_title'][0];\n } else {\n $postitem['meta_title'] = '';\n }\n\n // Meta desc\n $postitem['meta_desc'] = get_post_meta($postitem['id'], '_yoast_wpseo_metadesc');\n // Cleanup\n if (!empty($postitem['meta_desc'])) {\n $postitem['meta_desc'] = $postitem['meta_desc'][0];\n } else {\n $postitem['meta_desc'] = '';\n }\n } else {\n throw new Exception(\"Yoast is not installed or enabled.\");\n break;\n }\n\n $formattedPosts[$pte][] = $postitem;\n }\n\n // Putting it all inside a CSV file\n\n $csv_firstline = array(\"Wordpress ID\", \"URL\", \"Title\", \"Description\");\n $csv_fields = array();\n $csv_fields[] = $csv_firstline;\n if ($isBackup) {\n $csv_file = fopen(__DIR__ . \"/backup/_backup_mymetaisrich\" . date('m_d_Y__H_i_s') . \".csv\", \"w+\");\n } else {\n $csv_filename = \"/file/mymetaisrich_\" . date('m_d_Y__H_i_s') . '.csv';\n $csv_file = fopen(__DIR__ . $csv_filename, \"w+\");\n }\n\n foreach ($formattedPosts as $postType) {\n foreach ($postType as $postData) {\n $csv_fields[] = $postData;\n }\n }\n\n foreach ($csv_fields as $line) {\n fputcsv($csv_file, $line, ';');\n }\n\n fclose($csv_file);\n }\n\n if (!$isBackup) {\n echo '<a class=\"export__downloadlink\" href=\"/wp-content/plugins/mymetaisrich' . $csv_filename . '\" download>Download exported file</a>';\n }\n}", "public function galleries_custom_atom_entry() {\n\n\t\t$images =& get_children( 'post_parent=' . get_the_ID() . '&post_mime_type=image' );\n\n\t\tif ( empty ( $images ) ) {\n\n\t\t\treturn;\n\n\t\t} else {\n\n\t\t\tforeach( $images as $attachment_id => $attachment ) {\n\n\t\t\t\t$post_image_src = wp_get_attachment_image_src( $attachment_id, 'full' );\n\t\t\t\t$post_image_type = get_post_mime_type( $attachment_id );\n\t\t\t\t$post_image_meta = (array) wp_get_attachment_metadata( $attachment_id );\n\t\t\t\t$post_thumbnail_src = wp_get_attachment_image_src( $attachment_id, 'search' );\n\n\t\t\t\tif ( $post_image_credit = get_post_meta( $attachment_id, 'postmedia_attachment_credit', true ) )\n\t\t\t\t\t$post_image_credit = '<media:credit><![CDATA[' . $post_image_credit . ']]></media:credit>';\n\n\t\t\t\tif ( $post_image_caption = postmedia_get_attachment_caption( $attachment_id ) )\n\t\t\t\t\t$post_image_caption = '<media:description><![CDATA[' . $post_image_caption . ']]></media:description>';\n\t\t\t\t?>\n\n\t\t\t\t<media:content url=\"<?php echo esc_url( $post_image_src[0] ); ?>\" type=\"<?php echo esc_attr( $post_image_type ); ?>\" height=\"<?php echo esc_attr( $post_image_meta['height'] ); ?>\" width=\"<?php echo esc_attr( $post_image_meta['width'] ); ?>\" medium=\"image\" isDefault=\"true\">\n\t\t\t\t<media:title><![CDATA[<?php echo get_the_title( $attachment_id ); ?>]]></media:title>\n\t\t\t\t<?php echo $post_image_caption; ?>\n\t\t\t\t<?php echo $post_image_credit; ?>\n\n\t\t\t\t<?php\n\t\t\t\t$height = empty( $post_image_meta['sizes']['search']['height'] ) ? '' : $post_image_meta['sizes']['search']['height'];\n\t\t\t\t$width = empty( $post_image_meta['sizes']['search']['width'] ) ? '' : $post_image_meta['sizes']['search']['width'];\n\t\t\t\t?>\n\n\t\t\t\t<media:thumbnail url=\"<?php echo esc_url( $post_thumbnail_src[0] ); ?>\" height=\"<?php echo esc_attr( $height ); ?>\" width=\"<?php echo esc_attr( $width ); ?>\"/>\n\t\t\t\t</media:content>\n\n\t\t\t\t<?php\n\n\t\t\t}\n\n\t\t}\n\n\t}", "function _publication_xml_load_file($value){\n $value['url'] = url($value['uri'], array(\n 'absolute' => TRUE\n ));\n return ((object)$value);\n}", "function mla_insert_social_tags() {\r\n\tif ( is_page() ) {\r\n\t\tglobal $post;\r\n\t\tif ( empty( $post->post_content ) ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t$count = preg_match( '/\\[mla_gallery.*attachment_category=\"([^\\\"]*)\\\"/', $post->post_content, $mla_matches );\r\n\t\tif ( $count ) {\r\n\t\t\t$matched_category = $mla_matches[1]; // for preg_match\r\n\t\t\t$gallery = do_shortcode( sprintf( '[mla_gallery %1$s=\"%2$s\" size=full link=none mla_style=none posts_per_page=5]', 'attachment_category', $matched_category ) );\r\n\t\t\t$count = preg_match_all( '/src=\\\"([^\\\"]*)\\\"/', $gallery, $mla_matches );\r\n\t\t\tif ( $count ) {\r\n\t\t\t\tforeach ( $mla_matches[1] as $match ) {\r\n\t\t\t\t\techo sprintf( '<meta property=\"og:image\" content=\"%1$s\" />', $match ) . \"\\n\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\techo sprintf( '<meta name=\"twitter:image:src\" content=\"%1$s\" />', $mla_matches[1][0] ) . \"\\n\";\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t} // found mla_gallery\r\n\r\n\t\t$count = preg_match( '/\\[gallery.*ids=\"([^\\\"]*)\\\"/', $post->post_content, $mla_matches );\r\n\t\tif ( $count ) {\r\n\t\t\t$matched_posts = $mla_matches[1]; // for preg_match\r\n\t\t\t$gallery = do_shortcode( sprintf( '[mla_gallery %1$s=\"%2$s\" size=full link=none mla_style=none posts_per_page=5]', 'ids', $matched_posts ) );\r\n\t\t\t$count = preg_match_all( '/src=\\\"([^\\\"]*)\\\"/', $gallery, $mla_matches );\r\n\t\t\tif ( $count ) {\r\n\t\t\t\tforeach ( $mla_matches[1] as $match ) {\r\n\t\t\t\t\techo sprintf( '<meta property=\"og:image\" content=\"%1$s\" />', $match ) . \"\\n\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\techo sprintf( '<meta name=\"twitter:image:src\" content=\"%1$s\" />', $mla_matches[1][0] ) . \"\\n\";\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t} // found gallery\r\n}", "public function create_element_feed($arr){\n\t\t\n\t\t\n\t\t\n\t\tglobal $wp_query;\n\t\t\n\t\t$current_page = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 1;\n\t\t\n\t\tif(!empty($wp_query->query['page']) && $wp_query->query['page'] != 0){\n\t\t\t$current_page = (int) $wp_query->query['page'];\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t$per_page = !empty($arr['_per_page']) ? $arr['_per_page'] : 3;\n\t\t\n\t\t$offset = ($current_page - 1) * $per_page;\n\n\t\t$exclude = array();\n\t\t$content_types = $arr['_content_types'];\n\t\t\n\t\t$author = '';\n\t\t\n\t\tif(isset($arr['_author']))\n\t\t\t$author = $arr['_author'];\n\t\t\n\t\tforeach($content_types as $index => $content_type){\n\t\t\t\n\t\t\tif($content_type == \"children\"){\n\t\t\t\t//unset($content_types[$index]);\n\t\t\t\t$get_children = true;\n\t\t\t}\n\t\t\telse {\n\n\t\t\t\t\n\t\t\t\tif($content_type == \"post\")\n\t\t\t\t\t$term_name = 'category';\n\t\t\t\telse\n\t\t\t\t\t$term_name = $content_type.'_category';\n\n\t\t\t\tregister_taxonomy($term_name, $content_type,\n\t\t\t\t\tarray( \n\t\t\t\t\t\t'hierarchical' => true, \n\t\t\t\t\t\t'label' => 'Category',\n\t\t\t\t\t\t'query_var' => true,\n\t\t\t\t\t\t'rewrite' => array(\n\t\t\t\t\t\t\t'slug' => $content_type, // This controls the base slug that will display before each term\n\t\t\t\t\t\t\t'with_front' => false // Don't display the category base before \n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\t$terms = get_terms( array(\n\t\t\t\t\t'taxonomy' => $term_name,\n\t\t\t\t\t'hide_empty' => false,\n\t\t\t\t));\n\n\t\t\t\t\n\t\t\t\tif(!empty($terms)){\n\t\t\t\t\t\n\t\t\t\t\t$arr['categories'] = array();\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tforeach($terms as $term){\n\n\t\t\t\t\t\tif($term->slug != \"uncategorised\"){\n\n\t\t\t\t\t\t\t$temp_data = array(\n\t\t\t\t\t\t\t\t'category' => $term->slug,\n\t\t\t\t\t\t\t\t'category_title' => $term->name,\n\t\t\t\t\t\t\t\t'category_description' => $term->description\n\t\t\t\t\t\t\t);\n\n\n\t\t\t\t\t\t\tif($term->slug == $_REQUEST['category'])\n\t\t\t\t\t\t\t\t$temp_data['selected'] = 'true';\n\n\t\t\t\t\t\t\t$arr['categories'][] = $temp_data;\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t\n\t\t$element_file = $arr['_allowed_elements'];\n\n\t\tif(isset($arr['_feed_file']))\n\t\t\t$element_file = $arr['_feed_file'];\n\t\t\n\t\t$args = array(\n\t\t\t'posts_per_page' => $per_page,\n\t\t\t'offset' => $offset,\n\t\t\t'category' => '',\n\t\t\t'category_name' => '',\n\t\t\t'orderby' => $arr['_orderby'],\n\t\t\t'order' => $arr['_order'],\n\t\t\t'include' => '',\n\t\t\t'exclude' => $exclude,\n\t\t\t'meta_key' => '',\n\t\t\t'meta_value' => '',\n\t\t\t'post_type' => $content_types,\n\t\t\t'post_mime_type' => '',\n\t\t\t'post_parent' => '',\n\t\t\t'author'\t \t=> $author,\n\t\t\t'author_name'\t => '',\n\t\t\t'post_status' => 'publish',\n\t\t\t'suppress_filters' => true \n\t\t);\n\n\t\t\n\t\tif(!isset($arr[\"_category_file\"])) // if not loading data in \n\t\t{\n\n\t\t\t// FILTER BY CATEGORY\n\t\t\tif(isset($_REQUEST['category']) && $_REQUEST['category'] != \"all\"){\n\n\t\t\t\t$args['tax_query'] = array();\n\t\t\t\tforeach($content_types as $content_type){\n\n\t\t\t\t\tif($content_type == \"post\")\n\t\t\t\t\t\t$term_name = 'category';\n\t\t\t\t\telse\n\t\t\t\t\t\t$term_name = $content_type.'_category';\n\n\t\t\t\t\t$args['tax_query'][] = array(\n\t\t\t\t\t\t'taxonomy' => $term_name,\n\t\t\t\t\t\t'field' => 'slug',\n\t\t\t\t\t\t'terms' => $_REQUEST['category'], // Where term_id of Term 1 is \"1\".\n\t\t\t\t\t\t'include_children' => false\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$arr_feed = get_posts( $args );\t\t\n\n\n\t\t\tif($get_children){\n\t\t\t\tglobal $post;\n\n\t\t\t\t$children = get_pages(array(\n\t\t\t\t\t'sort_column' => 'menu_order',\n\t\t\t\t\t'parent' => $post->ID,\n\t\t\t\t\t'hierarchical' => 1\n\t\t\t\t)); \n\n\t\t\t\t// TO DO merge rather than replace and then re-order\n\t\t\t\t$arr_feed = $children;\n\t\t\t}\n\n\n\n\t\t\t$args['posts_per_page'] = -1;\n\t\t\t$arr_feed_total = count(get_posts( $args )); \n\n\t\t\t$count = 1;\n\t\t\t$total = count($arr_feed);\n\n\t\t\tforeach($arr_feed as $index => $feed_post){\n\n\t\t\t\t$feed_meta = array();\n\n\t\t\t\t//$feed_meta['description'] = get_post_meta($feed_post->ID,\"description\",true);\n\t\t\t\t//$feed_meta['image'] = get_post_meta($feed_post->ID,\"image\",true);\n\n\n\t\t\t\t$element_html = file_get_contents($this->html_files->element[$element_file]);\n\t\t\t\tpreg_match('/<!-- DATA -->([\\s\\S]*?)<!-- ENDDATA -->/',$element_html,$element_data);\n\t\t\t\t$element_data = (isset($element_data[1])) ? json_decode($element_data[1],true) : array();\n\n\n\t\t\t\tforeach($element_data as $index => $value){\n\n\t\t\t\t\t$feed_meta[$index] = get_post_meta($feed_post->ID,$index,true);\n\n\t\t\t\t\t//if($feed_meta[$index] == \"\")\n\t\t\t\t\t//\tunset($feed_meta[$index]);\n\t\t\t\t}\n\n\n\n\t\t\t\t$date_display = date('d M Y', strtotime($feed_post->post_date));\n\n\n\n\n\t\t\t\tif($content_type == \"post\")\n\t\t\t\t\t$term_name = 'category';\n\t\t\t\telse\n\t\t\t\t\t$term_name = $feed_post->post_type.'_category';\n\n\t\t\t\t$terms = wp_get_post_terms($feed_post->ID,$term_name);\n\t\t\t\t$all_terms = get_terms( array(\n\t\t\t\t\t'taxonomy' => $term_name,\n\t\t\t\t\t'hide_empty' => false,\n\t\t\t\t));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$temp_terms = array();\n\t\t\t\t\n\t\t\t\tforeach($all_terms as $index => $term){\n\t\t\t\t\t$temp_terms[] = $term->slug;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$category = \"\";\n\n\t\t\t\t$feed_meta['filter_numbers'] = \"\";\n\t\t\t\t\n\t\t\t\tforeach($terms as $index => $term){\n\n\t\t\t\t\t$category .= \"category--\".$term->slug.\" \";\n\t\t\t\t\t\n\t\t\t\t\t$feed_meta['filter_numbers'] .= 'filter__'.(array_search($term->slug,$temp_terms) + 1).' ';\n\t\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t$basic_vars = array(\n\t\t\t\t\t\"_type\" => \"element\",\n\t\t\t\t\t\"_name\" => $element_file,\n\t\t\t\t\t\"category\" => $category,\n\t\t\t\t\t\"url\" => get_permalink($feed_post->ID),\n\t\t\t\t\t\"_id\" => $feed_post->post_type.$feed_post->ID,\n\t\t\t\t\t\"_content_type\" => $feed_post->post_type,\n\t\t\t\t\t\"_content_type_display\" => str_replace(\"_\",\" \",$feed_post->post_type),\n\t\t\t\t\t\"_date\" => $feed_post->post_date,\n\t\t\t\t\t\"_date_display\" => $date_display,\n\t\t\t\t\t\"_count\" => $count,\n\t\t\t\t\t\"_total\" => $total\n\t\t\t\t);\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$count++;\n\n\n\t\t\t\t$feed_post = (array) $feed_post;\n\t\t\t\t$feed_meta = (array) $feed_meta;\n\n\n\t\t\t\t$module_arr = array_merge($feed_post,$feed_meta);\n\t\t\t\t$module_arr = array_merge($module_arr,$basic_vars);\n\n\t\t\t\tif($module_arr != false){\n\n\t\t\t\t\tif(isset($module_arr['post_title']))\n\t\t\t\t\t\t$module_arr['title'] = $module_arr['post_title'];\n\n\t\t\t\t\t$arr['_elements'][] = $this->update_fields($module_arr);\n\t\t\t\t}\n\n\n\t\t\t\tif($feed_post['ID'] == $arr_feed_last[0]->ID){\n\n\t\t\t\t\tunset($arr[$attr]['_next_page']);\n\t\t\t\t}\n\n\t\t\t\n\t\t\t}\n\n\n\n\n\t\t\t$total_pages = ceil($arr_feed_total/$per_page);\n\n\n\n\n\t\t\t$prev_page = $current_page == 1 ? 1 : $current_page - 1;\n\t\t\t$next_page = $current_page == $total_pages ? $total_pages : $current_page + 1;\n\n\n\t\t\t$arr['pages'] = array();\n\n\n\t\t\t// To do move into a function\n\t\t\tif($total_pages > 1){\n\n\t\t\t\t$arr['pages'][] = array(\n\t\t\t\t\t\"title\" => \"First\",\n\t\t\t\t\t\"number\" => \"1\",\n\t\t\t\t\t\"disabled\" => $current_page == 1 ? \"disabled\" : \"\",\n\t\t\t\t\t\"class\" => \"first_page_btn\"\n\t\t\t\t);\n\n\t\t\t\t$arr['pages'][] = array(\n\t\t\t\t\t\"title\" => \"Previous\",\n\t\t\t\t\t\"number\" => (string) $prev_page,\n\t\t\t\t\t\"disabled\" => $current_page == 1 ? \"disabled\" : \"\",\n\t\t\t\t\t\"class\" => \"previous_page_btn\"\n\t\t\t\t);\n\n\n\t\t\t\tfor ($x = 1; $x <= $total_pages; $x++) {\n\n\t\t\t\t\t$page_button = array(\n\t\t\t\t\t\t\"title\" => (string) $x,\n\t\t\t\t\t\t\"number\" => (string) $x\n\t\t\t\t\t);\n\n\n\t\t\t\t\tif($x == $current_page){\n\t\t\t\t\t\t$page_button[\"class\"] = \"current_page\";\n\t\t\t\t\t\t$page_button[\"disabled\"] = \"disabled\";\n\t\t\t\t\t}\n\t\t\t\t\telse if($x == $current_page - 1){\n\n\t\t\t\t\t\t$page_button[\"class\"] = \"previous_page\";\n\t\t\t\t\t}\n\t\t\t\t\telse if($x == $current_page + 1){\n\n\t\t\t\t\t\t$page_button[\"class\"] = \"next_page\";\n\t\t\t\t\t}\n\n\t\t\t\t\t$arr['pages'][] = $page_button;\n\t\t\t\t}\n\n\t\t\t\t$arr['pages'][] = array(\n\t\t\t\t\t\"title\" => \"Next\",\n\t\t\t\t\t\"number\" => (string) $next_page,\n\t\t\t\t\t\"disabled\" => $current_page == $total_pages ? \"disabled\" : \"\",\n\t\t\t\t\t\"class\" => \"next_page_btn\"\n\t\t\t\t);\n\n\t\t\t\t$arr['pages'][] = array(\n\t\t\t\t\t\"title\" => \"Last\",\n\t\t\t\t\t\"number\" => (string) $total_pages,\n\t\t\t\t\t\"disabled\" => $current_page == $total_pages ? \"disabled\" : \"\",\n\t\t\t\t\t\"class\" => \"last_page_btn\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$args['posts_per_page'] = -1;\n\t\t\t\n\t\t\tforeach($arr['categories'] as $id => $category)\n\t\t\t{\n\t\t\t\t// FILTER BY CATEGORY\n\t\t\t\t$args['tax_query'] = array();\n\t\t\t\tforeach($content_types as $content_type)\n\t\t\t\t{\n\t\t\t\t\tif($content_type == \"post\")\n\t\t\t\t\t\t$term_name = 'category';\n\t\t\t\t\telse $term_name = $content_type.'_category';\n\n\t\t\t\t\t$args['tax_query'][] = array(\n\t\t\t\t\t\t'taxonomy' => $term_name,\n\t\t\t\t\t\t'field' => 'slug',\n\t\t\t\t\t\t'terms' => $category['category'],\n\t\t\t\t\t\t'include_children' => false\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t$arr_feed = get_posts( $args );\n\n\t\t\t\t$total = count($arr_feed);\n\t\t\t\t\n\t\t\t\t// add category element to feed\n\t\t\t\tif($total > 0)\n\t\t\t\t{\n\t\t\t\t\t$count = 1;\n\t\t\t\t\t\n\t\t\t\t\t// add category element to feed\n\t\t\t\t\t$category[\"_type\"] = \"element\";\n\t\t\t\t\t$category[\"_name\"] = $arr[\"_category_file\"];\n\t\t\t\t\t$category[\"_id\"] = ($id+1);\n\t\t\t\t\t$arr['_elements'][] = $category;\n\n\t\t\t\t\tforeach($arr_feed as $index => $feed_post)\n\t\t\t\t\t{\n\t\t\t\t\t\t$feed_meta = array();\n\n\t\t\t\t\t\t$element_html = file_get_contents($this->html_files->element[$element_file]);\n\t\t\t\t\t\tpreg_match('/<!-- DATA -->([\\s\\S]*?)<!-- ENDDATA -->/',$element_html,$element_data);\n\t\t\t\t\t\t$element_data = (isset($element_data[1])) ? json_decode($element_data[1],true) : array();\n\n\t\t\t\t\t\tforeach($element_data as $index => $value)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$feed_meta[$index] = get_post_meta($feed_post->ID,$index,true);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$date_display = date('d M Y', strtotime($feed_post->post_date));\n\n\t\t\t\t\t\tif($content_type == \"post\")\n\t\t\t\t\t\t\t$term_name = 'category';\n\t\t\t\t\t\telse $term_name = $feed_post->post_type.'_category';\n\n\t\t\t\t\t\t$terms = wp_get_post_terms($feed_post->ID,$term_name);\n\t\t\t\t\t\t$category = \"\";\n\n\t\t\t\t\t\tforeach($terms as $index => $term)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$category .= \"category--\".$term->slug.\" \";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$basic_vars = array(\n\t\t\t\t\t\t\t\"_type\" => \"element\",\n\t\t\t\t\t\t\t\"_name\" => $element_file,\n\t\t\t\t\t\t\t\"category\" => $category,\n\t\t\t\t\t\t\t\"url\" => get_permalink($feed_post->ID),\n\t\t\t\t\t\t\t\"_id\" => $feed_post->post_type.$feed_post->ID,\n\t\t\t\t\t\t\t\"_content_type\" => $feed_post->post_type,\n\t\t\t\t\t\t\t\"_content_type_display\" => str_replace(\"_\",\" \",$feed_post->post_type),\n\t\t\t\t\t\t\t\"_date\" => $feed_post->post_date,\n\t\t\t\t\t\t\t\"_date_display\" => $date_display,\n\t\t\t\t\t\t\t\"_count\" => $count,\n\t\t\t\t\t\t\t\"_total\" => $total\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t$count++;\n\n\n\t\t\t\t\t\t$feed_post = (array) $feed_post;\n\t\t\t\t\t\t$feed_meta = (array) $feed_meta;\n\n\n\t\t\t\t\t\t$module_arr = array_merge($feed_post,$feed_meta);\n\t\t\t\t\t\t$module_arr = array_merge($module_arr,$basic_vars);\n\n\t\t\t\t\t\tif($module_arr != false)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(isset($module_arr['post_title']))\n\t\t\t\t\t\t\t\t$module_arr['title'] = $module_arr['post_title'];\n\n\t\t\t\t\t\t\t$arr['_elements'][] = $this->update_fields($module_arr);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\treturn $arr;\n\t}", "function getauthor($file){\n$dm_xml_pic_start = explode(\"<media:credit>\",$file,2);\n$dm_xml_pic_end = explode(\"</media:credit>\",$dm_xml_pic_start[1],2);\n$dm_pic = $dm_xml_pic_end[0];\nreturn $dm_pic;\n}", "function mmir_importMetas()\n{\n\n mmir_exportMetas(true); // isBackup à true.\n\n\n // Then we read the CSV file\n\n $uploadedFile = wp_handle_upload($_FILES['field__import'], array('test_form' => false));\n if ($uploadedFile && !isset($uploadedFile['error'])) {\n // No error\n $imported_CSV = fopen($uploadedFile['file'], 'r');\n $header = fgetcsv($imported_CSV, 1024, ';');\n while (!feof($imported_CSV)) {\n $line = fgetcsv($imported_CSV, 1024, ';');\n if (count($line) < 4 && $line) {\n throw new Exception('CSV file is not formatted properly.');\n } else {\n $post_id = $line[0] ?? '';\n $post_meta_title = $line[2] ?? '';\n $post_meta_desc = $line[3] ?? '';\n\n if (!empty($post_id)) {\n update_post_meta($post_id, '_yoast_wpseo_title', $post_meta_title);\n update_post_meta($post_id, '_yoast_wpseo_metadesc', $post_meta_desc);\n echo '<div class=\"import__processed\">Post ID ' . $post_id . ' processed' . '</div>';\n }\n }\n }\n } else {\n // Eroor\n throw new Exception('Upload failed.');\n }\n}", "public function leerArchivo (){\n if (isset($_FILES[\"archivo\"]) && is_uploaded_file($_FILES['archivo']['tmp_name'])) {\n //SE ABRE EL ARCHIVO EN MODO LECTURA\n $fp = fopen($_FILES['archivo']['tmp_name'], \"r\");\n //RECORRER $fp\n $d = array();\n while (!feof($fp)){ //LEE EL ARCHIVO A DATA, LO VECTORIZA A DATA\n $data = explode(\",\", fgets($fp));//SI SE LEE SEPARADO POR COMAS\n \n if ($data>0) {\n $d[]=$data;\n }else \"Archivo Vacio\"; \n \n } \n } else{ \n echo \"Error de subida\";\n } return $d;\n \n }", "function omv_get_all_pages_data($f3,$manga, $chapter) {\n$omv_img_types = $f3->get(\"img_types\");\n$pages = array();\n$base_dir = $f3->get('base_dir');\n$dirname = \"$base_dir/$manga/$chapter/\";\n$dir = @opendir($dirname);\nif ($dir) {\nwhile (($file = @readdir($dir)) !== false) {\nif (!is_dir($dirname . $file . '/')) {\n\t\nlist($width,$height) = getimagesize($dirname . $file);\n\n$file_extension = strtolower(substr($file, strrpos($file, \".\") + 1));\nif (in_array($file_extension, $omv_img_types)) {\n$pages[] = array(\"file_name\" => $file,\"width\" => $width,\"height\" => $height);\n}\n}\n}\n@closedir($dir);\n}\n\nsort($pages);\n\nreturn $pages;\n}", "function my_post_gallery( $output, $attr ) {\n \n \t// Initialize\n \tglobal $post, $wp_locale;\n \n \t// Gallery instance counter\n \tstatic $instance = 0;\n \t$instance++;\n \n \t// Validate the author's orderby attribute\n \tif ( isset( $attr['orderby'] ) ) {\n \t\t$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );\n \t\tif ( ! $attr['orderby'] ) unset( $attr['orderby'] );\n \t}\n \n \t// Get attributes from shortcode\n \textract( shortcode_atts( array(\n \t\t'order' => 'ASC',\n \t\t'orderby' => 'menu_order ID',\n \t\t'id' => $post->ID,\n \t\t'itemtag' => 'li',\n \t\t'icontag' => 'li',\n \t\t'captiontag' => 'dd',\n \t\t'columns' => 3,\n \t\t'size' => 'thumbnail',\n \t\t'include' => '',\n \t\t'exclude' => ''\n \t), $attr ) );\n \n \t// Initialize\n \t$id = intval( $id );\n \t$attachments = array();\n \tif ( $order == 'RAND' ) $orderby = 'none';\n \n \tif ( ! empty( $include ) ) {\n \n \t\t// Include attribute is present\n \t\t$include = preg_replace( '/[^0-9,]+/', '', $include );\n \t\t$_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );\n \n \t\t// Setup attachments array\n \t\tforeach ( $_attachments as $key => $val ) {\n \t\t\t$attachments[ $val->ID ] = $_attachments[ $key ];\n \t\t}\n \n \t} else if ( ! empty( $exclude ) ) {\n \n \t\t// Exclude attribute is present \n \t\t$exclude = preg_replace( '/[^0-9,]+/', '', $exclude );\n \n \t\t// Setup attachments array\n \t\t$attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );\n \t} else {\n \t\t// Setup attachments array\n \t\t$attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );\n \t}\n \n \tif ( empty( $attachments ) ) return '';\n \n\n \n \t// Filter tags and attributes\n \t$itemtag = tag_escape( $itemtag );\n \t$captiontag = tag_escape( $captiontag );\n \t$columns = intval( $columns );\n \t$itemwidth = $columns > 0 ? floor( 100 / $columns ) : 100;\n \t$float = is_rtl() ? 'right' : 'left';\n \t$selector = \"gallery-{$instance}\";\n \n \t// Filter gallery CSS\n \t$output = apply_filters( 'gallery_style', \"\n \t\t<div id='$selector' class='gallery frame-inline galleryid-{$id}'><div class='slidee'>\"\n \t);\n \n \t// Iterate through the attachments in this gallery instance\n \t$i = 0;\n \tforeach ( $attachments as $id => $attachment ) {\n \n \t\t// Attachment link\n \t // \t$link = isset( $attr['link'] ) && 'file' == $attr['link'] ? : wp_get_attachment_link( $id, $size, true, false );\n $img = wp_get_attachment_image_src( $id, 'large');\n $width = $img[1];\n $height = $img[2];\n \n \t\t// Start itemtag\n \t\t$output .= \"<div class='sly-slide'>\";\n \n \t\t$output .= \"<img data-src='\". $img[0] . \"' data-width='\". $width . \"' data-height='\". $height . \"'>\";\n \n \t\t// End itemtag\n \t\t$output .= \"<div class='shades'></div></div>\";\n \n \t\t// Line breaks by columns set\n \t// \tif($columns > 0 && ++$i % $columns == 0) $output .= '<br style=\"clear: both\">';\n \n \t}\n \n \t// End gallery output\n \t$output .= \"</div>\n <div class='sly-controls'>\n <button class='gallery-home button button-white' id='inline-gallery-home'>back to start</button>\n <button class='sly-prev'><i class='icon-arrow-left'></i></button>\n <button class='sly-next'><i class='icon-arrow-right'></i></button>\n </div></div>\";\n \n \treturn $output;\n \n }", "function getfile($file) {\n\n $fileitem = [];\n $fileitem['name'] = (string)$file->name();\n $fileitem['type'] = (string)$file->type();\n $fileitem['extension'] = (string)$file->extension();\n $fileitem['src'] = (string)$file->url();\n\n if($fileitem['type'] == 'image'):\n $fileitem['height'] = (string)$file->height();\n $fileitem['width'] = (string)$file->width();\n $fileitem['ratio'] = (string)round($file->ratio()*100)/100;\n $fileitem['orientation'] = (string)$file->orientation();\n $fileitem['thumbnails'] = getthumbnails($file);\n endif;\n\n if($fileitem['type'] == 'video'):\n //$stillfromvideo = $file->thumb(['clip' => true, 'still' => true]);\n //$fileitem['height'] = (string)$stillfromvideo->height();\n //$fileitem['width'] = (string)$stillfromvideo->width();\n //$fileitem['ratio'] = (string)round($stillfromvideo->ratio()*100)/100;\n //$fileitem['orientation'] = (string)$stillfromvideo->orientation();\n endif;\n\n foreach($file->content(get('language'))->data() as $key => $value):\n $fileitem['meta'][$key] = $value;\n endforeach;\n\n return $fileitem;\n }", "function get_metadata ()\n {\n $options = get_option ( 'ogp' );\n // == let's set some default values\n \n // site_name - the name of the site\n $site_name = get_option('blogname');\n \n // image\n if ( is_array ( $options ) && isset ( $options['image']['url'] ) && ( '' != $options['image']['url'] ) )\n $image = $options['image']['url'];\n // use the header image, if available\n else\n /** @todo use header image thumbnail */\n $image = ( defined('HEADER_IMAGE') AND '' != get_header_image() ) ? get_header_image() : '';\n \n $admins = ( is_array ( $options ) && isset ( $options['facebook']['admins'] ) && ( '' != $options['facebook']['admins'] ) ) ? $options['facebook']['admins'] : '';\n \n $app_id = ( is_array ( $options ) && isset ( $options['facebook']['app_id'] ) && ( '' != $options['facebook']['app_id'] ) ) ? $options['facebook']['app_id'] : '';\n \n // title - use the same value as for site_name\n $title = $site_name;\n \n // type\n if ( is_array ( $options ) && isset ( $options['type']['type'] ) && ( '' != $options['type']['type'] ) )\n $type = $options['type']['type'];\n // defaults to 'blog'\n else\n $type = 'blog';\n \n // url - always use the blog url\n $url = get_bloginfo('url');\n \n // description - use the tagline\n /** @todo this shall become editable on a settings page */\n $description = get_option('blogdescription');\n \n $posts_on = !is_array ( $options ) || !isset ( $options['advanced']['posts_on'] ) || ( '1' == $options['advanced']['posts_on'] );\n $pages_on = !is_array ( $options ) || !isset ( $options['advanced']['pages_on'] ) || ( '1' == $options['advanced']['pages_on'] );\n \n // == if we're dealing with an individual post or page\n global $post;\n if ( ( in_the_loop() && ( ( ( 'post' == $post->post_type ) && $posts_on ) || ( ( 'page' == $post->post_type ) && $pages_on ) ) ) || ( is_single() && $posts_on ) || ( is_page() && $pages_on ) )\n {\n $meta = get_post_meta ( $post->ID, '_ogp__open_graph_pro', true );\n if ( is_array ( $meta ) && !( isset ( $meta['toggle'] ) && ( 'off' == $meta['toggle'] ) ) && isset ( $meta['use_page'] ) )\n {\n $thispost = get_post ( $meta['use_page'] );\n $meta = get_post_meta ( $thispost->ID, '_ogp__open_graph_pro', true );\n }\n else\n $thispost = $post;\n \n if ( !( is_array ( $meta ) && isset ( $meta['toggle'] ) && ( 'off' == $meta['toggle'] ) ) ) // ogp not toggled off\n {\n \n // title - the post title\n $title = $thispost->post_title;\n \n $type = ( is_array ( $meta ) && isset ( $meta['type'] ) ) ? $meta['type'] : 'article';\n \n // url - always use the permalink\n $url = get_permalink($thispost->ID);\n \n // image -- if we have any post images, use them; featured image (a.k.a. post thumbnail) will be preferred (if there's no image here, use header image from above)\n if ( !is_array ( $options ) || !isset ( $options['image']['headeronly'] ) || ( '1' != $options['image']['headeronly'] ) )\n {\n if ( function_exists ( 'has_post_thumbnail' ) AND has_post_thumbnail($thispost->ID) )\n {\n $attachment = wp_get_attachment_image_src ( get_post_thumbnail_id($thispost->ID) );\n $image = $attachment[0];\n }\n elseif ( preg_match ( '/<img\\s[^>]*src=[\"\\']?([^>\"\\']+)/i', $thispost->post_content, $match ) )\n $image = $match[1];\n }\n \n // description - use the excerpt if available, else use the content\n $description = strip_tags ( $thispost->post_excerpt ? $thispost->post_excerpt : $thispost->post_content );\n \n // Facebook user IDs from $meta\n if ( is_array ( $meta ) && isset ( $meta['fb_admins'] ) && ( '' != $meta['fb_admins'] ) )\n {\n $admins = ogp__open_graph_pro::sanitize_fb_admins ( $admins.','.$meta['fb_admins'] );\n }\n \n } // ogp not toggled off\n }\n \n // clean up the description, i.e. strip any html tags, completely normalize whitespace, etc., and truncate at 255 characters length\n $description = preg_replace ( '/\\s+/', ' ', $description );\n if ( strlen ( $description ) > 255 ) $description = substr ( $description, 0, 252 ) . '...';\n $description = $description;\n \n // return an array containing all the meta information\n $a = array ( 'og' => array ( 'id' => 'http://ogp.me/ns#', 'metadata' => compact ( 'title', 'site_name', 'description', 'type', 'url', 'image' ) ) );\n if ( ( '' != $admins ) || ( '' != $app_id ) )\n $a['fb'] = array ( 'id' => 'http://www.facebook.com/2008/fbml', 'metadata' => compact ( 'admins', 'app_id' ) );\n return apply_filters ( 'ogp_get_metadata', $a );\n }", "function getthumb($file){\n$dm_xml_pic_start = explode(\"<media:thumbnail url=\\\"\",$file,2);\n$dm_xml_pic_end = explode(\"\\\"\",$dm_xml_pic_start[1],2);\n$dm_pic = $dm_xml_pic_end[0];\nreturn $dm_pic;\n}", "function dt_get_all_media_ids() {\n if ( false === ( $all_media_ids = get_transient( 'dt_all_media_ids' ) ) ) {\n $all_media_ids = get_posts( array(\n 'post_type' => 'attachment',\n 'post_mime_type' => 'image',\n 'post_status' => 'inherit', \n 'posts_per_page' => -1,\n 'fields' => 'ids',\n ) );\n // cache for 2 hours\n set_transient( 'dt_all_media_ids', $all_media_ids, 60*60*2 );\n }\n\n return $all_media_ids;\n}", "function miu_get_images($post_id=null) {\r\n global $post;\r\n if ($post_id == null) {\r\n $post_id = $post->ID;\r\n }\r\n\r\n $value = get_post_meta($post_id, 'miu_images', true);\r\n $images = unserialize($value);\r\n $result = array();\r\n if (!empty($images)) {\r\n\t\tforeach ($images as $image) {\r\n $result[] = $image;\r\n }\r\n }\r\n return $result;\r\n}", "function getArticle($id) {\n try {\n //Need to prune\n //$result = mysql_query('SELECT post_title, post_excerpt, guid, post_mime_type from wp_posts where ID IN (SELECT A.post_id FROM wp_posts AS P INNER JOIN wp_postmeta AS A ON P.ID = A.post_id WHERE P.ID =\"' . $id . '\" AND A.meta_key=\"_thumbnail_id\") AND post_mime_type !=\"application/pdf\"');\n $result1 = mysql_query('SELECT guid,post_mime_type from wp_posts WHERE ID IN (SELECT A.meta_value FROM wp_posts AS P INNER JOIN wp_postmeta AS A ON P.ID = A.post_id WHERE P.post_name = \"' . $id . '\" AND A.meta_key=\"_thumbnail_id\") and post_type=\"attachment\"');\n $result2 = mysql_query('SELECT post_title,post_excerpt from wp_posts WHERE ID IN (SELECT A.post_id FROM wp_posts AS P INNER JOIN wp_postmeta AS A ON P.ID = A.post_id WHERE P.post_name = \"' . $id . '\" AND A.meta_key=\"_thumbnail_id\")');\n $row = mysql_fetch_array($result1);\n if ($row[\"guid\"]) {\n array_push($row, (mysql_fetch_array($result2)));\n $row[\"post_title\"]=$row[2][\"post_title\"];\n $row[\"post_excerpt\"]=$row[2][\"post_excerpt\"];\n return $row;\n } else {\n $result = mysql_query('SELECT P.post_title, P.post_excerpt, A.guid, A.post_mime_type FROM wp_posts as P INNER JOIN wp_posts as A ON P.ID=A.post_parent AND A.post_type=\"attachment\" WHERE P.post_name = \"' . $id . '\"');\n $row = mysql_fetch_array($result);\n return $row;\n }\n } catch (Exception $e) {\n echo 'Caught exception: ', $e->getMessage(), \"\\n\";\n }\n}", "function cpum_scan_site()\r\n{\r\n\tset_time_limit(360);\r\n\t\r\n\t$posts = get_posts(array(\r\n\t\t'post_type' => 'any',\r\n\t\t'numberposts' => -1\r\n\t));\r\n\r\n\tif ( empty($posts) )\r\n\t\treturn false; \r\n\t\r\n\t$titles = array();\r\n\t\r\n\tforeach ( $posts as $post ){ \r\n\t\t$attachment_ids = Codepress_Used_Media::add_postid_to_attachments($post->ID, $post);\r\n\t\t\r\n\t\tif ( $attachment_ids ) {\r\n\t\t\tforeach ( $attachment_ids as $id ) {\r\n\t\t\t\t\r\n\t\t\t\t$title = get_the_title($id);\t\t\t\t\r\n\t\t\t\tif ( $link = get_edit_post_link($id) ) {\r\n\t\t\t\t\t$title = \"<a href='{$link}'>{$title}</a>\";\r\n\t\t\t\t}\r\n\t\t\t\t$titles[] = $title;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn array_unique( $titles );\r\n}", "public function getMetadataArray(){\n\n\n $handle = file_get_contents('metadata.xml');\n\n //initialize the array for all metadata information\n $array = [];\n\n if($handle){\n //$xml = file_get_contents(asset('metadata.xml'));\n //load the xml string and make it into array\n $xml = simplexml_load_string($handle);\n $json = json_encode($xml);\n $array = json_decode($json,true);\n }\n return $array;\n }", "function monthly_arch($tipo='normal') {\n\tglobal $tipost;\n\tglobal $POST;\n\tglobal $ISINDEX;\n\t$tipost\t\t=file_get_contents(\"monthly-arch.php\",true);\n\tif (0===strlen($tipost)) $tipost=file_get_contents(\"capa-post.php\",true);\n\t$ISINDEX=true;\n\t$tipost=aplica_plugins('index',$tipost,'post',$tipo,'post');\n\t$item=substpostvars(substparms($tipost));\n\treturn $item;\n}", "public function lecturaArchivo()\r\n\t\t{\r\n\r\n\t\t\tif ( self::existeArchivo() ) {\r\n\r\n\t\t\t\t// Ruta y nonmbre del archivo\r\n\t\t\t\t$ruta = self::getRuta() . self::getNombre();\r\n\r\n\t\t\t\t$fp = fopen($ruta, \"r\");\r\n\t\t\t\t$ct = 0;\r\n\t\t\t\twhile(!feof($fp)) {\r\n\t\t\t\t\t$linea = fgets($fp);\r\n\t\t\t\t\tif ( $ct > 0 ) {\r\n\t\t\t\t\t\tif ( $linea !== null ) {\r\n\t\t\t\t\t\t\t//echo $linea . \"<br />\";\r\n\t\t\t\t\t\t\tself::armarItemPago($linea, $ct);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$ct++;\r\n\t\t\t\t}\r\n\t\t\t\tfclose($fp);\r\n\t\t\t}\r\n\t\t}", "function galleria_content()\n{ \n\n $galleria_fs = wp_upload_dir();\n $galleria_data_path = $galleria_fs[\"basedir\"].\"/wp-galleria/\";\n if(!file_exists($galleria_data_path))\n mkdir($galleria_data_path);\n \n global $wp_query;\n $galleria_permalink = get_permalink($wp_query->post->ID);\n $galleria_get_str = \"galleria\";\n \n if(!isset($_GET[$galleria_get_str])) {\n\t$galleria_query_path = null;\n\t$galleria_path = $galleria_data_path;\n } else {\n\t$galleria_query_path = $_GET[$galleria_get_str];\n\t$galleria_path = $galleria_data_path . $galleria_query_path;\n }\n $galleria_web_loc = $galleria_fs[\"baseurl\"].\"/wp-galleria/\".$galleria_query_path.\"/\";\n $galleria_path_thumbs = $galleria_path.\"/thumbs\";\n $galleria_img_w = 150;\n $galleria_img_h = 150;\n \n if($galleria_query_path != null) {\n\t$galleria_breadcrumbs = array_filter(explode(\"/\", $galleria_query_path));\n\t$galleria_breadcrumbs = array_filter($galleria_breadcrumbs);\n\t\n\t$galleria_breadcrumbs_done = $galleria_breadcrumbs[0];\n\techo \"<h3><a href=\\\"$galleria_permalink\\\">\" . __('Index', 'wp_galleria') . \"</a>\";\n\tforeach($galleria_breadcrumbs as $g_b) {\n\t if($galleria_breadcrumbs_done != $g_b)\n\t\t$galleria_breadcrumbs_done = $galleria_breadcrumbs_done . \"/\" . $g_b;\n\t echo \" / <a href=\\\"\".add_query_arg($galleria_get_str, $galleria_breadcrumbs_done, $galleria_permalink).\"\\\">$g_b</a>\";\n\t}\n\techo \"</h3>\";\n }\n \n if (($files = @scandir($galleria_path)) && count($files) <= 2) {\n\techo \"<p>\".__('No galleries/photos yet.', 'wp_galleria').\"</p>\";\n }\n else\n {\n\t$galleria_children = array();\n\tforeach($files as $file) {\n\t if($file != '.' && $file != '..' && $file != 'thumbs' && is_dir($galleria_path.\"/\".$file)) {\n\t\tif($galleria_query_path)\n\t\t $galleria_filepath = $galleria_query_path.\"/\".$file;\n\t\telse\n\t\t $galleria_filepath = $file;\n\t\t$galleria_children[] = \"\\t\".\"<li class=\\\"galleria-list\\\">\n\t\t\t\t\t<a href=\\\"\".add_query_arg($galleria_get_str, $galleria_filepath, $galleria_permalink).\"\\\">\n\t\t\t\t\t$file</a></li>\".\"\\n\";\n\t }\n\t if($file != '.' && $file != '..' && $file != 'thumbs' && !is_dir($galleria_path.\"/\".$file)) {\n\t\t$galleria_finfo = pathinfo($file);\n\t\tif(preg_match(\"/jpg|jpeg|JPEG|JPG|png|PNG/\",$galleria_finfo[\"extension\"])) {\n\t\t if(!file_exists($galleria_path_thumbs.\"/\".$file))\n\t\t\tgalleria_createthumb(\n\t\t\t\t$galleria_path_thumbs,\n\t\t\t\t$galleria_path.\"/\".$file,\n\t\t\t\t$galleria_path_thumbs.\"/\".$file,\n\t\t\t\t$galleria_img_w,\n\t\t\t\t$galleria_img_h\n\t\t\t\t);\n\t\t $galleria_imgs[] = \"\\t\".\"<li class=\\\"galleria-photo\\\">\n\t\t\t\t\t<a href=\\\"\".$galleria_web_loc.$file.\"\\\" rel=\\\"\".md5($galleria_query_path).\"\\\" >\n\t\t\t\t\t<img src=\\\"\".$galleria_web_loc.\"thumbs/\".$file.\"\\\" alt=\\\"\".esc_html('_', ' ', $galleria_query_path).\"\\\" />\n\t\t\t\t\t</a></li>\".\"\\n\";\n\t\t}\n\t }\n\t}\n \n\tif(count($galleria_children) > 0 || count($galleria_imgs) > 0) {\n\t echo \"<ul id=\\\"wp-galleria\\\" class=\\\"wp-galleria\\\">\".\"\\n\";\n\t if(count($galleria_children) > 0)\n\t\tforeach($galleria_children as $galleria_child) {\n\t\t echo $galleria_child;\n\t\t}\n\t if(count($galleria_imgs) > 0)\n\t\tforeach($galleria_imgs as $galleria_i) {\n\t\t echo $galleria_i;\n\t\t}\n\t echo \"</ul>\".\"\\n\";\n\t}\n }\n}" ]
[ "0.5762541", "0.57185435", "0.55662745", "0.55583715", "0.55470604", "0.5511506", "0.539464", "0.5376053", "0.53436357", "0.53335184", "0.5285143", "0.5284187", "0.5254258", "0.5198982", "0.5181115", "0.5177731", "0.51519036", "0.5145179", "0.51329434", "0.5104077", "0.5090319", "0.5080391", "0.50661683", "0.50640595", "0.5049384", "0.50407946", "0.5040388", "0.5037914", "0.50360715", "0.502067" ]
0.7747567
0
[guardar_entradas_importadas guardamos las nuevas entradas en la base de datos]
public function guardar_entradas_importadas($entradas = null){ foreach ($entradas as $entrada) { //por defecto declaramos NULL el categoria_id de las entradas $entrada['categoria_id'] = NULL; //si hya categorias declarada la guardamos y obtenemos su id if(!is_null($entrada['categoria'])){ //recogemos el nombre de la categoria, en formato slug $categoria_slug = normalizar_string($entrada['categoria']); //buscamos el slug en la base de dados $categoria_db = Categoria::where('slug',$categoria_slug)->first(); //si la categoria no exites, la creamos if(!$categoria_db){ $categoria_new = new Categoria; $categoria_new->nombre = $entrada['categoria']; $categoria_new->slug = $categoria_slug; $categoria_new->save(); $categoria_db = $categoria_new; } //recoremos el id de la categorias $entrada['categoria_id'] = $categoria_db->id; } //todas las entras que importamos son borradores $entrada['borrador'] = true; //guardamos la nueva entrada en la base de datos $entrada_new = Blog::create($entrada); $entrada['blog_id'] = $entrada_new->id; //guardamos las etiquetas de la entrada BlogTag::where('blog_id',$entrada_new->id)->delete(); $tags_objeto = explode(",",$entrada['etiquetas']); foreach ($tags_objeto as $tags => $value) { $db['blog_id'] = $entrada_new->id; $db['tag'] = $value; BlogTag::insert($db); } //guardamos las configuracion seo de la entrada; $entrada_seo = BlogSeo::create($entrada); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function importar_entradas_post(Request $request){\n\n //datos comunes de las vistas\n $datos_vista = $this->cargar_datos();\n\n //recogeos el nombre del tipo de importacion\n $tipo_importacion = $request->tipo_importacion;\n\n //declaramos el metodo que vamos utilizar segun el tipo de importacion\n $metodo = 'cargar_archivo_'.$tipo_importacion;\n\n //recogemos el array de entradas que nos devuelve el metodo declarado\n $array_entradas = $this->$metodo();\n\n //guardamos las nuevas entradas en la base de datos\n $guardar_entradas_importadas = $this->guardar_entradas_importadas($array_entradas);\n\n //definimos el paso en que nos encontramos\n $datos_vista['paso'] = 'resumen-importar-entradas';\n\n //definimos el numero de las nuevas entradas\n $datos_vista['num_entradas'] = count($array_entradas);\n\n return return_vistas('blogs.importar-entradas', $datos_vista);\n }", "function import() {\n\t\t// vyprazdnim tabulku\n\t\t$this->truncate();\n\t\t$condition = null;\n\t\t$snProducts = $this->findAllSn();\n\t\tforeach ($snProducts as $snProduct) {\n\t\t\tif ($product = $this->transformSn($snProduct)) {\n\t\t\t\t$this->create();\n\t\t\t\tif (!$this->save($product)) {\n\t\t\t\t\tdebug($product);\n\t\t\t\t\tdebug($this->validationErrors);\n\t\t\t\t\t$this->save($product, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function importarArquivo() {\n \n $sMsgErro = \"Importação de Arquivo Censo abortada!\\n\"; \n if (!db_utils::inTransaction()) {\n throw new Exception(\"Nenhuma transação do banco encontrada!\");\n }\n \n $this->sNomeArquivoLog = \"tmp/censo\".$this->iAnoEscolhido.\"_importacao_\".db_getsession(\"DB_coddepto\").\"_\";\n $this->sNomeArquivoLog .= db_getsession(\"DB_id_usuario\").\"_\".date(\"dmY\").\"_\".date(\"His\").\"_log.txt\";\n \n $this->pArquivoLog = fopen($this->sNomeArquivoLog, \"w\"); \n if (!$this->pArquivoLog) {\n throw new Exception(\" Não foi possível abrir o arquivo de log! \"); \n } \n \n if ($this->lIncluirAlunoNaoEncontrado) { \n $this->log(\"Registros atualizados na importação do Censo Escolar:\\n\\n\");\n } else {\n $this->log(\"Registros não atualizados na importação do Censo Escolar:\\n\\n\"); \n }\n \n try {\n \n $this->validaArquivo(); \n $this->getLinhasArquivo($this->iCodigoLayout); \n $aLinhasArquivo = $this->getLinhasArquivo();\n \n \n } catch (Exception $eException) {\n throw new Exception($sMsgErro.\" \".$eException->getMessage());\n }\n \n foreach ($aLinhasArquivo as $iIndLinha => $oLinha) {\n \t\n if ($this->lImportarEscola) {\n \t\n \tif ($oLinha->tiporegistro == \"00\") {\n \t $this->atualizaCodigoInepEscola($oLinha);\n \t}\n \t\n }\t\n \n if ($this->lImportarTurma) {\n \t\n \tif ($oLinha->tiporegistro == \"20\") {\n \t $this->atualizaCodigoInepTurma($oLinha);\n \t}\n \t\n }\n \n if ($this->lImportarDocente) {\n \t\n \tif ($oLinha->tiporegistro == \"30\") {\n \t $this->atualizaCodigoInepDocente($oLinha);\n \t}\n \t\n }\n \n if ($this->lImportarAluno) {\n \t\n \tif ($oLinha->tiporegistro == \"60\") {\n \t $this->atualizaCodigoInepAluno($oLinha);\n \t}\n \t\n }\n \n }\n\n }", "public function provider_import ()\n {\n $import = $this->get_import_db_adapter ();\n $wcos1_upload_path = APPLICATION_PATH . '/../public/wcos1_uploads/';\n \n $query = $import->select ()->from ('anbieter', array ('anbieterID', 'stammdatenID', 'firmenname', 'name1', 'name2', 'anbieterhash', 'last_login', 'number', 'LebenszeitID', 'Suchname', 'lastChange', 'created', 'premiumLevel', 'systems')); \n $anbieter_data = $import->fetchAll ($query);\n \n foreach ($anbieter_data as $anbieter)\n { \n //visits\n $query = $import->select ()->from ('stats_visits', array ('COUNT(vmKundennummer)'))->where ('vmKundennummer ='.$anbieter ['anbieterID']);\n $visits = $import->fetchOne ($query);\n \n //Anbieter-Kern-Daten\n $anbieter_table_data = $anbieter;\n $premiumLevel = $anbieter_table_data ['premiumLevel'];\n $systems = $anbieter_table_data ['systems'];\n unset ($anbieter_table_data ['premiumLevel'], $anbieter_table_data ['systems']);\n $anbieter_table_data ['visits'] = $visits;\n $this->_db->insert ('anbieter', $anbieter_table_data);\n \n //Stammdaten\n $query = $import->select ()->from ('stammdaten', array ('stammdatenID', 'anbieterID', 'strasse', 'hausnummer', 'land', 'plz', 'ort', 'fon', 'fax', 'email', 'www', 'mediaID'))->where ('stammdatenID = '.$anbieter ['stammdatenID'])->where ('anbieterID ='.$anbieter ['anbieterID']);\n $stammdaten_table_data = $import->fetchRow ($query);\n //$mediaID = $stammdaten_table_data ['mediaID'];\n $stammdaten_table_data ['id'] = $stammdaten_table_data ['stammdatenID'];\n unset ($stammdaten_table_data ['mediaID'], $stammdaten_table_data ['stammdatenID']);\n \n if (!empty ($stammdaten_table_data ['id'])) \n $this->_db->insert ('stammdaten', $stammdaten_table_data);\n \n //Firmenlogo\n $query = $import->select ()->from ('media')->where ('anbieterID = '. $anbieter ['anbieterID'])->where ('mediatyp = \"FIRMENLOGO\"');\n $media_orig_data = $import->fetchRow ($query);\n if (!empty ($media_orig_data))\n { \n $filename_new = md5 ($media_orig_data ['mediadatei'].rand().time ()).'.'.$media_orig_data ['mediaExtension'];\n shell_exec ('cp '.$wcos1_upload_path.$media_orig_data ['mediaID'].'.'.$media_orig_data ['mediaExtension'].' '.UPLOAD_PATH.$filename_new); \n $this->_db->insert ('media', array ('anbieterID' => $media_orig_data ['anbieterID'], 'media_type' => 5, 'beschreibung' => $media_orig_data ['beschreibung'], 'media' => $filename_new, 'link' => $media_orig_data ['link'], 'object_id' => $anbieter ['stammdatenID'], 'system_id' => 0));\n }\n \n //System-Stati\n $system_data = array ();\n $system_data ['anbieterID'] = $anbieter ['anbieterID']; \n \n $systeme = array (1, 2, 3, 405, 999); \n $premium_systems = array_filter (explode (',', $systems));\n $query = $import->select ()->from ('laufzeiten')->where ('anbieterID = '. $anbieter ['anbieterID']);\n $runtimes = $import->fetchRow ($query);\n foreach ($systeme as $system_id)\n {\n $system_data ['premium'] = ($premiumLevel == 1 AND in_array ($system_id, $premium_systems)) ? 1 : 0; \n $system_data ['start'] = '';\n $system_data ['end'] = '';\n $system_data ['system_id'] = $system_id; \n \n if ($system_data ['premium'] == 1 AND !empty ($runtimes))\n {\n $start = new Zend_Date ($runtimes ['startdatum']);\n $system_data ['start'] = $start->get (Zend_Date::TIMESTAMP);\n $start_date_parts = array_filter (explode ('-', substr ($runtimes ['startdatum'], 0, 10)));\n $system_data ['end'] = mktime (0, 0, 0, (int)$start_date_parts [1] + $runtimes ['laufzeit'], (int)$start_date_parts [2], (int)$start_date_parts [0]);\n } \n \n $this->_db->insert ('systeme', $system_data); \n } \n } \n }", "public function createImportarfuncionarios(){\n $this->importarfuncionarios_model->insert_importarfuncionarios();\n echo \"sucesso\"; \n }", "public function executeImportarEjercicios()\n {\n $this->errors = array();\n $mensaje_importar = '';\n\n // Si se ha hecho submit procesamos el formulario\n if ($this->getRequest()->getMethod() == sfRequest::POST) {\n if ($this->getRequest()->getFileName('my_file')) {\n if (is_readable($_FILES['my_file']['tmp_name'])) {\n $my_file = $_FILES['my_file']['tmp_name'];\n $id_materia = $this->getRequestParameter('materia');\n $xml = simplexml_load_file($my_file);\n if (!$xml) {$this->errors[] = 'Fichero XML incorrecto - fallo en load'; return;}\n\n $ejercicio = new Ejercicio();\n $solucion_ejercicio = new Ejercicio_resuelto();\n\n if ($xml->getName() != 'ejercicio') {$this->errors[] = 'Fichero XML incorrecto - fallo en esquema 1'; return;}\n\n $id_admin = $this->getUser()->getAnyId();\n $solucion_ejercicio->setIdAutor($id_admin);\n $ejercicio->setIdAutor($id_admin);\n $ejercicio->setIdMateria($id_materia);\n $ejercicio->setNombreAutor((string) $xml['nombre_autor']);\n $tipo = $xml['tipo'];\n $ejercicio->setTipo((string) $xml['tipo']);\n $ejercicio->setTitulo((string) $xml['titulo']);\n $ejercicio->setTestMultiple((int) $xml['test_multiple']);\n $ejercicio->setTestResta((int) $xml['test_resta']);\n $numero_respuestas_test = (int) $xml['numero_respuestas'];\n $ejercicio->setNumeroRespuestas($numero_respuestas_test);\n $ejercicio->setSolucion((int) $xml['solucion']);\n $ejercicio->setExpresionesMatematicas((int) $xml['expresiones_matematicas']);\n $ejercicio->setNumeroHojas((int) $xml['numero_hojas']);\n\n $expmat = $ejercicio->getExpresionesMatematicas();\n\n $array_cuestiones = array();\n $array_soluciones = array();\n $index1 = 0;\n\n foreach ($xml->children() as $cuestion) {\n if ($cuestion->getName() != 'cuestion') {$this->errors[] = 'Fichero XML incorrecto - fallo en esquema 2'; return;}\n\n switch ($tipo) {\n case 'test':\n $enunciado = (string) $cuestion->pregunta;\n $cref = new Cuestion_test();\n $cref->setPregunta($enunciado);\n $cref->setNumeroRespuestasCorrectas((int) $cuestion['ncorrectas']);\n $cref->setNumeroRespuestasIncorrectas((int) $cuestion['nincorrectas']);\n $array_cuestiones[$index1] = $cref;\n\n $index2 = 0;\n foreach ($cuestion->respuestas->respuesta as $respuesta) {\n $rref = new Respuesta_cuestion_test();\n if ($respuesta['correcta']) {\n $correcta = (int) $respuesta['correcta'];\n } else {\n $correcta = 0;\n }\n $rref->setCorrecta($correcta);\n $rref->setRespuesta((string) $respuesta);\n $array_soluciones[\"$index1.$index2\"] = $rref;\n $index2++;\n }\n $index1++;\n break;\n\n case 'cuestionario':\n $enunciado = (string) $cuestion->pregunta;\n $puntuacion = (string) $cuestion['puntuacion'];\n\n $cref = new Cuestion_corta();\n $cref->setPregunta($enunciado);\n $cref->setPuntuacion($puntuacion);\n $array_cuestiones[] = $cref;\n\n $solucion = (string) $cuestion->solucion;\n $sref = new Respuesta_cuestion_corta();\n $sref->setRespuesta($solucion);\n $array_soluciones[] = $sref;\n break;\n\n case 'problemas':\n $enunciado = (string) $cuestion->pregunta;\n $puntuacion = (string) $cuestion['puntuacion'];\n\n $cref = new Cuestion_practica();\n $cref->setContenidoLatex($enunciado);\n $cref->setPuntuacion($puntuacion);\n $array_cuestiones[] = $cref;\n break;\n default: break;\n }\n }\n // Bucle2\n switch ($tipo) {\n case 'test':\n $ejercicio->save();\n $solucion_ejercicio->setIdEjercicio($ejercicio->getId());\n $solucion_ejercicio->save();\n $ejercicio->setIdSolucion($solucion_ejercicio->getId());\n $ejercicio->save();\n\n $index1 = 0;\n foreach ($array_cuestiones as $cref) {\n $cref->setIdEjercicio($ejercicio->getId());\n $cref->save();\n\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(1, 't', $cref->getId(), $cref->getPregunta());\n }\n for ($index2 = 0; $index2 < $numero_respuestas_test; $index2++) {\n $rref = $array_soluciones[\"$index1.$index2\"];\n $rref->setIdCuestionTest($cref->getId());\n $rref->save();\n\n if ($rref->getCorrecta()) {\n $sref = new Seleccion_cuestion_test();\n $sref->setIdEjercicioResuelto($solucion_ejercicio->getId());\n $sref->setIdRespuestaCuestionTest($rref->getId());\n $sref->save();\n }\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(0, 't', $rref->getId(), $rref->getRespuesta());\n }\n }\n $index1++;\n }\n break;\n\n case 'cuestionario':\n // Guardamos el ejercicio y sus preguntas si todo fue bien\n $ejercicio->save();\n $solucion_ejercicio->setIdEjercicio($ejercicio->getId());\n $solucion_ejercicio->save();\n $ejercicio->setIdSolucion($solucion_ejercicio->getId());\n $ejercicio->save();\n\n for ($index = 0; $index < sizeof($array_cuestiones); $index++) {\n $cref = $array_cuestiones[$index];\n $cref->setIdEjercicio($ejercicio->getId());\n $cref->save();\n\n $sref = $array_soluciones[$index];\n $sref->setIdCuestionCorta($cref->getId());\n $sref->setIdEjercicioResuelto($solucion_ejercicio->getId());\n $sref->save();\n\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(1, 'c', $cref->getId(), $cref->getPregunta());\n $this->crearExpMat(0, 'c', $sref->getId(), $sref->getRespuesta());\n }\n }\n break;\n\n case 'problemas':\n // Guardamos el ejercicio y sus preguntas si todo fue bien\n $ejercicio->save();\n $solucion_ejercicio->setIdEjercicio($ejercicio->getId());\n $solucion_ejercicio->save();\n $ejercicio->setIdSolucion($solucion_ejercicio->getId());\n $ejercicio->save();\n\n for ($index = 0; $index < sizeof($array_cuestiones); $index++) {\n $cref = $array_cuestiones[$index];\n $cref->setIdEjercicio($ejercicio->getId());\n $cref->save();\n\n // Procesamiento de expresiones matematicas\n if ($expmat) {\n $this->crearExpMat(1, 'p', $cref->getId(), $cref->getContenidoLatex());\n }\n }\n break;\n default: break;\n }\n $mensaje_importar = '<strong>El ejercicio \"'.$ejercicio->getTitulo().'\" importado satisfactoriamente</strong>';\n $this->ejercicio = $ejercicio; // necesario para los test\n }\n }\n }\n $c = new Criteria();\n $this->materias = MateriaPeer::DoSelect($c);\n $this->errors = $this->errors;\n $this->mensaje_importar = $mensaje_importar;\n }", "public function imprimirTabla()\r\n {\r\n try{\r\n $consulta = $this->PDO->prepare(\"CALL sp_impCliente()\");//el nombre de la tabla\r\n $consulta->execute();\r\n \r\n \r\n foreach ($consulta->fetchAll(PDO::FETCH_OBJ) as $fila )\r\n {\r\n $cliente = new Cliente();//se instancia la clase que se esta haciendo\r\n $cliente->__SET('FK_tipoDocumento', $fila->Nombre_TipoDeDocumento);//se llama el campo de la tabla que corresponda con el atributo de la clase\r\n $cliente->__SET('documentoCliente', $fila->Documento_Cliente);//se llama el campo de la tabla que corresponda con el atributo de la clase\r\n $cliente->__SET('primerNombre', $fila->PrimerNombre_Cliente);//se llama el campo de la tabla que corresponda con el atributo de la clase\r\n $cliente->__SET('segundoNombre', $fila->SegundoNombre_Cliente);//se llama el campo de la tabla que corresponda con el atributo de la clase\r\n $cliente->__SET('primerApellido', $fila->PrimerApellido_Cliente);//se llama el campo de la tabla que corresponda con el atributo de la clase\r\n $cliente->__SET('segundoApellido', $fila->SegundoApellido_Cliente);//se llama el campo de la tabla que corresponda con el atributo de la clase\r\n $cliente->__SET('correo', $fila->Correo_Cliente);//se llama el campo de la tabla que corresponda con el atributo de la clase\r\n $cliente->__SET('telefono', $fila->Telefono_Cliente);//se llama el campo de la tabla que corresponda con el atributo de la clase\r\n $cliente->__SET('FK_perfil', $fila->Tipo_Perfil);//se llama el campo de la tabla que corresponda con el atributo de la clase\r\n $cliente->__SET('estado',$fila->Estado_Cliente == 0 ? 'inactivo':'activo');//se repite segun los campos que hayan en la tabla\r\n $cliente->__SET('fechaCreacion',$fila->FechaDeCreacion_Cliente);\r\n $result[] = $cliente; \r\n \r\n }\r\n return $result;//se devuelve el arreglo result\r\n } \r\n catch (Exception $e)\r\n {\r\n die($e->getMessage());\r\n }\r\n \r\n }", "private function insertIntoDBBaseData()\n\t{\n\n\t\t// Lastschriftmandate einlesen\n\t\t$query = \"SELECT * FROM centron_mand_ref WHERE activeStatus = 'yes' ORDER BY personenkonto\";\n\t\t$result = $this->query($query);\n\t\t$num_rows = $this->num_rows($result);\n\n\t\tif ($num_rows >= '1') {\n\t\t\t$mandRefArray = array();\n\t\t\twhile ($row = $result->fetch_object()) {\n\n\t\t\t\t$mandRefArray[$row->personenkonto] = $row->mandatsnummer;\n\t\t\t}\n\t\t}\n\t\t$this->free_result($result);\n\n\t\t// Die erste Reihe in der .csv - Datei ist eine \"Ueberschrift\"?\n\t\t$skipHeadline = false;\n\n\t\t// Setting in welcher Spalte steht was?\n\t\t$setRowKDNummer = 0;\n\t\t$setRowName1 = 1;\n\t\t$setRowStrasseHnr = 2;\n\t\t$setRowPLZ = 3;\n\t\t$setRowOrt = 4;\n\t\t$setRowTelefon = 5;\n\t\t$setRowEmail = 6;\n\t\t// $setRowZahlungstyp = 7;\n\t\t$setIBAN = 8;\n\t\t$setSWIFT = 9;\n\t\t$setLandCode = 10;\n\t\t// $setLandName = 11;\n\t\t$setBKLZ = 12;\n\t\t$setBankNr = 13;\n\n\t\t$zeilen = $this->coreGlobal['ImportValue'];\n\t\t// $downloadLink = $this->coreGlobal['curDownloadLink'];\n\t\t// $IDt = $this->coreGlobal['curSourceTypeID'];\n\t\t// $IDs = $this->coreGlobal['curSourceSystemID'];\n\n\n\t\t$cntKunden = 0;\n\t\t$errorArray = array();\n\t\t$warningArray = array();\n\n\n\t\t// Tabelle leeren!\n\t\t$this->query('TRUNCATE TABLE `centron_basedata`');\n\n\t\t// Jede Zeile / Kunde durchgehen und entsprechend in die DB speichern\n\t\tforeach($zeilen as $kunde) {\n\n\t\t\t// Headline in Rohdatei? Wenn ja, überspringe ich die erste Zeile\n\t\t\tif (($skipHeadline) && ($cntKunden == 0)) {\n\t\t\t\t$skipHeadline = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\n\t\t\t// Aktuelle Kundennummer!\n\t\t\t$curKundenNummer = trim($kunde[$setRowKDNummer]);\n\n//\t\t\t$tmpKdNr = trim($kunde[$setRowKDNummer]);\n//\t\t\tif (($tmpKdNr == '10148') || ($tmpKdNr == '10371') || ($tmpKdNr == '10131'))\n//\t\t\t\tcontinue;\n\n\n\t\t\t// Haben wir eine Kundennummer?\n\t\t\tif (strlen($curKundenNummer) < 1) {\n\t\t\t\t$this->addMessage('Fehlende Kunden-Nr.', 'Fehlende Kundennummer, hier in \" die vorliegenden Daten: \"' . $curKundenNummer . '\"\"', 'Warnung', 'Datenbank-Import');\n\t\t\t\tcontinue;\n\t\t\t}\n\n\n\t\t\t// Strassenstring für Hausnummer und Hausnummer-Zusatz zerlegen\n\t\t\tif (!isset($kunde[$setRowStrasseHnr])) {\n\t\t\t\t$strassenname = '';\n\t\t\t\t$hausnummer = '';\n\t\t\t\t$hausnummerzusatz = '';\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$strassenname = trim($kunde[$setRowStrasseHnr]);\n\t\t\t\t$hausnummer = \"\";\n\t\t\t\t$hausnummerzusatz = \"\";\n\t\t\t\t$search = '/([^\\d]+)(\\d+)?([^\\d]+)?/i';\n\t\t\t\tif (preg_match_all($search, $strassenname, $result)) {\n\t\t\t\t\t$strassenname = trim($result[1][0]);\n\t\t\t\t\t$hausnummer = trim($result[2][0]);\n\t\t\t\t\t$hausnummerzusatz = trim($result[3][0]);\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// Mandatsreferenznummer\n\t\t\t$curMandRef = '';\n\t\t\tif (isset($mandRefArray[$curKundenNummer])) {\n\t\t\t\t$curMandRef = $mandRefArray[$curKundenNummer];\n\t\t\t}\n\n\n\t\t\t// Straßenname sollte jetzt bekannt sein\n\t\t\tif (strlen($strassenname) < 2) {\n\t\t\t\t$errorArray[$curKundenNummer]['Strasse'] = 'Fehlender Straßenname';\n\t\t\t\t$this->addMessage('Fehlender Straßenname', 'Fehlender Straßenname bei Kunden-Nr.: ' . $curKundenNummer, 'Warnung', 'Datenbank-Import');\n\t\t\t\tcontinue;\n\t\t\t}\n\n\n\t\t\t// Escapen für DB - Insert z.B. bei Name: Up'n Nien Esch\n\t\t\t$strassenname = addslashes($strassenname);\n\n\n\t\t\t// Eintrag - Zähler erhöhen\n\t\t\t$cntKunden++;\n\n\n\t\t\tif (!isset($kunde[$setRowPLZ])) {\n\t\t\t\t$PLZ = '';\n\t\t\t\t$warningArray[$curKundenNummer]['PLZ'] = 'Fehlende PLZ';\n\t\t\t}\n\t\t\telse\n\t\t\t\t$PLZ = trim($kunde[$setRowPLZ]);\n\n\n\n\t\t\tif (!isset($kunde[$setRowOrt])) {\n\t\t\t\t$Ort = '';\n\t\t\t\t$warningArray[$curKundenNummer]['PLZ'] = 'Fehlender Ortsname';\n\t\t\t}\n\t\t\telse\n\t\t\t\t$Ort = trim($kunde[$setRowOrt]);\n\n\n\n\t\t\tif (!isset($kunde[$setRowTelefon])) {\n\t\t\t\t$Telefon = '';\n\t\t\t\t$warningArray[$curKundenNummer]['Telefon'] = 'Fehlende Telefonnummer';\n\t\t\t}\n\t\t\telse\n\t\t\t\t$Telefon = trim($kunde[$setRowTelefon]);\n\n\n\n\t\t\tif (!isset($kunde[$setRowEmail])) {\n\t\t\t\t$Email = '';\n\t\t\t\t$warningArray[$curKundenNummer]['Email'] = 'Fehlende Email';\n\t\t\t}\n\t\t\telse\n\t\t\t\t$Email = trim($kunde[$setRowEmail]);\n\n\n\n\t\t\tif (!isset($kunde[$setIBAN]))\n\t\t\t\t$IBAN = '';\n\t\t\telse\n\t\t\t\t$IBAN = trim($kunde[$setIBAN]);\n\n\n\n\t\t\tif (!isset($kunde[$setLandCode]))\n\t\t\t\t$Laendercode = '';\n\t\t\telse\n\t\t\t\t$Laendercode = trim($kunde[$setLandCode]);\n\n\n\n\t\t\tif (!isset($kunde[$setBankNr]))\n\t\t\t\t$Kontonummer = '';\n\t\t\telse\n\t\t\t\t$Kontonummer = trim($kunde[$setBankNr]);\n\n\n\n\t\t\tif (!isset($kunde[$setBKLZ]))\n\t\t\t\t$BLZ = '';\n\t\t\telse\n\t\t\t\t$BLZ = trim($kunde[$setBKLZ]);\n\n\n\n\t\t\tif (!isset($kunde[$setSWIFT]))\n\t\t\t\t$BIC = '';\n\t\t\telse\n\t\t\t\t$BIC = trim($kunde[$setSWIFT]);\n\n\n\n\t\t\t$anschrifts_name1 = trim($kunde[$setRowName1]);\n\t\t\t$anschrifts_name2 = \"\";\n\t\t\tif (strlen($anschrifts_name1) > 35) {\n\t\t\t\t$anschrifts_name2 = substr($anschrifts_name1, 35);\n\t\t\t\t$anschrifts_name1 = substr($anschrifts_name1, 0, 35);\n\t\t\t}\n\n\n\n\t\t\t$name1 = trim($kunde[$setRowName1]);\n\t\t\t$name2 = \"\";\n\t\t\tif (strlen($name1) > 30) {\n\t\t\t\t$name2 = substr($name1, 30);\n\t\t\t\t$name1 = substr($name1, 0, 30);\n\t\t\t}\n\n\n\n\t\t\t$search = '/,$/i';\n\t\t\tif (preg_match_all($search, $name1, $result)) {\n\t\t\t\t$newValue = '';\n\t\t\t\t$name1 = preg_replace($search, $newValue, $name1);\n\t\t\t}\n\n\n\n\t\t\t$search = '/,$/i';\n\t\t\tif (preg_match_all($search, $name2, $result)) {\n\t\t\t\t$newValue = '';\n\t\t\t\t$name2 = preg_replace($search, $newValue, $name2);\n\t\t\t}\n\n\n\n\t\t\t// Personenkonto sprich Kundennummer zuweisen\n\t\t\t$personenkonto = $curKundenNummer;\n\n\n\n\t\t\t// Welches System soll genutzt werden (das Alte nur mit SZ oder das Neue mit SZ und BL als Zahlart)\n\t\t\tif ($_SESSION['Cfg']['Default']['Centron']['ZahlungsartOldNew'] == 'new') {\n\n\t\t\t\t// Zahlungsart Lastschrift oder Überweisung?\n\t\t\t\t// Wenn eine BIC vorliegt... gehen wir von Lastschrift aus... festgelegt durch:\n\t\t\t\t// L. Koschin am 12.04.2016\n\t\t\t\tif (strlen($BIC) > 0)\n\t\t\t\t\t$zahlungsart = $_SESSION['Cfg']['Default']['Centron']['ZahlungsartBL'];\n\t\t\t\telse\n\t\t\t\t\t$zahlungsart = $_SESSION['Cfg']['Default']['Centron']['Zahlungsart'];\n\n\t\t\t}\n\t\t\telse\n\t\t\t\t$zahlungsart = $_SESSION['Cfg']['Default']['Centron']['Zahlungsart'];\n\n\n\n\t\t\t$dynInsertQuery = \"INSERT INTO centron_basedata (\n `userID`,\n `Personenkonto`,\n `Name1`,\n `Name2`,\n `Sammelkonto`,\n `Laendercode`,\n `BLZ`,\n `BIC`,\n `Kontonummer`,\n `IBAN`,\n `Zahlungsart`,\n `Mandatsreferenznummer`,\n `Anschrift_Name1`,\n `Anschrift_Name2`,\n `Anschrift_PLZ`,\n `Anschrift_Ort`,\n `Anschrift_Strasse`,\n `Anschrift_Hausnummer`,\n `Zusatzhausnummer`,\n `Telefon`,\n `Email`\n ) VALUES (\n '\" . $_SESSION['Login']['userID'] . \"',\n '\" . $personenkonto . \"',\n '\" . $name1 . \"',\n '\" . $name2 . \"',\n '\" . $_SESSION['Cfg']['Default']['Centron']['Sammelkonto'] . \"',\n '\" . $Laendercode . \"',\n '\" . $BLZ . \"',\n '\" . $BIC . \"',\n '\" . $Kontonummer . \"',\n '\" . $IBAN . \"',\n '\" . $zahlungsart . \"',\n '\" . $curMandRef . \"',\n '\" . $anschrifts_name1 . \"',\n '\" . $anschrifts_name2 . \"',\n '\" . $PLZ . \"',\n '\" . $Ort . \"',\n '\" . $strassenname . \"',\n '\" . $hausnummer . \"',\n '\" . $hausnummerzusatz . \"',\n '\" . $Telefon . \"',\n '\" . $Email . \"'\n )\n \";\n\n\t\t\t$dynUpdateQuery = \" ON DUPLICATE KEY UPDATE\n\t\t\t\t\t\t\t\t`userID` = '\" . $_SESSION['Login']['userID'] . \"',\n\t\t\t\t\t\t\t `updateCounter`\t\t\t= updateCounter + 1,\n `Name1` = '\" . $name1 . \"',\n `Name2` = '\" . $name2 . \"',\n `Sammelkonto` = '\" . $_SESSION['Cfg']['Default']['Centron']['Sammelkonto'] . \"',\n `Laendercode` = '\" . $Laendercode . \"',\n `BLZ` = '\" . $BLZ . \"',\n `BIC` = '\" . $BIC . \"',\n `Kontonummer` = '\" . $Kontonummer . \"',\n `IBAN` = '\" . $IBAN . \"',\n `Zahlungsart` = '\" . $zahlungsart . \"',\n `Mandatsreferenznummer` = '\" . $curMandRef . \"',\n `Anschrift_Name1` = '\" . $anschrifts_name1 . \"',\n `Anschrift_Name2` = '\" . $anschrifts_name2 . \"',\n `Anschrift_PLZ` = '\" . $PLZ . \"',\n `Anschrift_Ort` = '\" . $Ort . \"',\n `Anschrift_Strasse` = '\" . $strassenname . \"',\n `Anschrift_Hausnummer` = '\" . $hausnummer . \"',\n `Zusatzhausnummer` = '\" . $hausnummerzusatz . \"',\n `Telefon` = '\" . $Telefon . \"',\n `Email` = '\" . $Email . \"'\n \";\n\n\n\t\t\t// Parameter für getQuery setzen\n\t\t\t$paramArray = array('dynInsertQuery' => $dynInsertQuery,\n\t\t\t\t\t\t\t\t'dynUpdateQuery' => $dynUpdateQuery);\n\n\n\t\t\t// DB Eintrag erstellen oder Updaten (Query erstellen)!\n\t\t\t//$query = \"INSERT INTO centron_basedata \" . $paramArray['dynInsertQuery'] . \" ON DUPLICATE KEY UPDATE \" . $paramArray['dynUpdateQuery'];\n\t\t\t$query = $paramArray['dynInsertQuery'] . $paramArray['dynUpdateQuery'];\n\n\t\t\t// Query ausführen\n\t\t\t$this->query($query);\n\n\t\t} // END foreach ($zeilen as $kunde){\n\n\n\t\t// Alle anderen Datensätze als nicht aktiv in DB markieren\n\t\t$query = \"UPDATE file_upload SET enumIsCurrentInDB = 'no' WHERE sourceTypeID = '\" . $this->coreGlobal['curSourceTypeID'] . \"' AND fileUploadID != '\" . $this->coreGlobal['POST']['selFileUploadID'] . \"'\";\n\t\t$this->query($query);\n\n\n\t\t// Import Counter und Import-Datum aktuallisieren\n\t\t$query = \"UPDATE file_upload SET importCounter = importCounter+1, lastImport = now(), enumIsCurrentInDB = 'yes' WHERE fileUploadID = '\" . $this->coreGlobal['POST']['selFileUploadID'] . \"' LIMIT 1\";\n\t\t$this->query($query);\n\n\n\t\t// Belegten Speicher in der global wieder freigeben\n\t\tunset($this->coreGlobal['ImportValue']);\n\t\tunset($this->coreGlobal['curDownloadLink']);\n\t\tunset($this->coreGlobal['curSourceTypeID']);\n\t\tunset($this->coreGlobal['curSourceSystemID']);\n\t\tunset($this->coreGlobal['curDownloadLink']);\n\t\tunset($this->coreGlobal['curFilePath']);\n\n\n\n\t\t// Informationen ausgeben\n\t\tif ($cntKunden > 0)\n\t\t\t$this->addMessage('Datenbank - Import erfolgreich!', $cntKunden . ' Datensätze wurden erfolreich in die Datenbank übernommen.', 'Erfolg', 'Datenbank - Import');\n\t\telse\n\t\t\t$this->addMessage('Datenbank - Import durchgeführt!', 'Es wurden keine Datensätze in die Datenbank übernommen.', 'Erfolg', 'Datenbank - Import');\n\n\n\t\treturn true;\n\n\t}", "public function importOldData() {\n\n ini_set('max_execution_time', 3600); //3600 seconds = 60 minutes\n\n $logger = $this->container->get('logger');\n $em = $this->em;\n\n //$email = \"[email protected]\";\n $requests = array();\n\n $default_time_zone = $this->container->getParameter('default_time_zone');\n $userSecUtil = $this->container->get('user_security_utility');\n $userkeytype = $userSecUtil->getUsernameType($this->usernamePrefix);\n\n ////////////// add system user /////////////////\n //$userUtil = new UserUtil();\n //$userUtil = $this->container->get('user_utility');\n //$systemuser = $userUtil->createSystemUser($userkeytype,$default_time_zone);\n ////////////// end of add system user /////////////////\n\n //VacReqAvailabilityList\n// $emailAvailable = $this->em->getRepository('AppVacReqBundle:VacReqAvailabilityList')->findOneByAbbreviation('email');\n// $phoneAvailable = $this->em->getRepository('AppVacReqBundle:VacReqAvailabilityList')->findOneByAbbreviation('phone');\n// $otherAvailable = $this->em->getRepository('AppVacReqBundle:VacReqAvailabilityList')->findOneByAbbreviation('other');\n// $noneAvailable = $this->em->getRepository('AppVacReqBundle:VacReqAvailabilityList')->findOneByAbbreviation('none');\n //process.py script: replaced namespace by ::class: ['AppVacReqBundle:VacReqRequestTypeList'] by [VacReqRequestTypeList::class]\n $requestType = $this->em->getRepository(VacReqRequestTypeList::class)->findOneByAbbreviation(\"business-vacation\");\n if( !$requestType ) {\n exit('No request type found with abbreviation \"business-vacation\"');\n }\n\n $notExistingUsers = array();\n $count = 0;\n\n $inputFileName = __DIR__ . '/vacreqExportData_full_before_27May2016.xls';\n\n try {\n $inputFileType = \\PhpOffice\\PhpSpreadsheet\\IOFactory::identify($inputFileName);\n $objReader = \\PhpOffice\\PhpSpreadsheet\\IOFactory::createReader($inputFileType);\n $objPHPExcel = $objReader->load($inputFileName);\n } catch( \\Exception $e ) {\n $error = 'Error loading file \"'.pathinfo($inputFileName,PATHINFO_BASENAME).'\": '.$e->getMessage();\n $logger->error($error);\n die($error);\n }\n\n $sheet = $objPHPExcel->getSheet(0);\n $highestRow = $sheet->getHighestRow();\n $highestColumn = $sheet->getHighestColumn();\n\n $headers = $rowData = $sheet->rangeToArray('A' . 1 . ':' . $highestColumn . 1,\n NULL,\n TRUE,\n FALSE);\n\n\n //for each request in excel (start at row 2)\n for( $row = 2; $row <= $highestRow; $row++ ) {\n\n //Read a row of data into an array\n $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row,\n NULL,\n TRUE,\n FALSE);\n\n //Insert row data array into the database\n //echo $row.\": \";\n //var_dump($rowData);\n //echo \"<br>\";\n\n $exportId = $this->getValueByHeaderName('FACULTY_REQUEST_ID', $rowData, $headers);\n $exportId = trim((string)$exportId);\n //echo \"exportId=\".$exportId.\"<br>\";\n\n //if( $exportId != 1840 ) {continue;} //testing\n\n //process.py script: replaced namespace by ::class: ['AppVacReqBundle:VacReqRequest'] by [VacReqRequest::class]\n $request = $this->em->getRepository(VacReqRequest::class)->findOneByExportId($exportId);\n if( $request ) {\n continue; //ignore existing request to prevent overwrite\n }\n\n //$FACULTY_NAME = $this->getValueByHeaderName('FACULTY_NAME', $rowData, $headers);\n\n $email = $this->getValueByHeaderName('FACULTY_EMAIL', $rowData, $headers);\n //echo \"email=\".$email.\"<br>\";\n if( !$email ) {\n //continue; //ignore existing request to prevent overwrite\n $error = 'Email not found for exportId='.$exportId;\n $logger->error($error);\n throw new \\Exception( $error );\n }\n\n $emailParts = explode(\"@\", $email);\n $cwid = $emailParts[0];\n\n //exceptions for some users\n\n //echo \"cwid=\".$cwid.\"<br>\";\n\n $BUS_FIRST_DAY_AWAY = $this->getValueByHeaderName('BUS_FIRST_DAY_AWAY', $rowData, $headers); //24-OCT-12\n $BUS_FIRST_DAY_AWAY_Date = $this->transformDatestrToDate($BUS_FIRST_DAY_AWAY);\n $VAC_FIRST_DAY_AWAY = $this->getValueByHeaderName('VAC_FIRST_DAY_AWAY', $rowData, $headers);\n $VAC_FIRST_DAY_AWAY_Date = $this->transformDatestrToDate($VAC_FIRST_DAY_AWAY);\n\n $username = $cwid.\"_@_\". $this->usernamePrefix;\n //process.py script: replaced namespace by ::class: ['AppUserdirectoryBundle:User'] by [User::class]\n $submitter = $this->em->getRepository(User::class)->findOneByUsername($username);\n if( !$submitter ) {\n\n //get newest date\n $newestDate = $this->getNewestDate($BUS_FIRST_DAY_AWAY_Date,$VAC_FIRST_DAY_AWAY_Date);\n //echo \"submitter not found; newest date=\".$this->convertDateTimeToStr($newestDate).\"<br>\";\n\n if( array_key_exists($email, $notExistingUsers) ) {\n $existingNewestDate = $notExistingUsers[$email];\n $notExistingUsers[$email] = $this->getNewestDate($existingNewestDate,$newestDate);\n } else {\n $notExistingUsers[$email] = $this->getNewestDate($BUS_FIRST_DAY_AWAY_Date,$VAC_FIRST_DAY_AWAY_Date);\n }\n\n continue;\n //throw new \\Exception( 'Submitter not found for exportId='.$exportId.\" by username=\" . $username );\n }\n\n $request = new VacReqRequest($submitter);\n\n //set request type\n $request->setRequestType($requestType);\n\n $request->setExportId($exportId);\n\n //set emergency\n //EMERGENCY_EMAIL\n $EMERGENCY_EMAIL = $this->getValueByHeaderName('EMERGENCY_EMAIL', $rowData, $headers);\n if( $EMERGENCY_EMAIL ) {\n $request->setAvailableViaEmail(true);\n //FACULTY_EMAIL\n $FACULTY_EMAIL = $this->getValueByHeaderName('FACULTY_EMAIL', $rowData, $headers);\n $request->setAvailableEmail($FACULTY_EMAIL);\n //$request->addAvailability($emailAvailable);\n }\n //EMERGENCY_PHONE\n $EMERGENCY_PHONE = $this->getValueByHeaderName('EMERGENCY_PHONE', $rowData, $headers);\n if( $EMERGENCY_PHONE ) {\n $request->setAvailableCellPhone(true);\n //CELL_PHONE\n $CELL_PHONE = $this->getValueByHeaderName('CELL_PHONE', $rowData, $headers);\n $request->setAvailableCellPhone($CELL_PHONE);\n }\n //EMERGENCY_OTHER\n $EMERGENCY_OTHER = $this->getValueByHeaderName('EMERGENCY_OTHER', $rowData, $headers);\n if( $EMERGENCY_OTHER ) {\n $request->setAvailableViaOther(true);\n //OTHER\n $OTHER = $this->getValueByHeaderName('OTHER', $rowData, $headers);\n $request->setAvailableOther($OTHER);\n }\n //NOT_ACCESSIBLE\n $NOT_ACCESSIBLE = $this->getValueByHeaderName('NOT_ACCESSIBLE', $rowData, $headers);\n if( $NOT_ACCESSIBLE ) {\n $request->setAvailableNone(true);\n }\n\n //FACULTY_PHONE\n $FACULTY_PHONE = $this->getValueByHeaderName('FACULTY_PHONE', $rowData, $headers);\n if( $FACULTY_PHONE ) {\n $request->setPhone($FACULTY_PHONE);\n }\n\n //BUSINESS_REQUEST\n $BUSINESS_REQUEST = $this->getValueByHeaderName('BUSINESS_REQUEST', $rowData, $headers);\n if( $BUSINESS_REQUEST ) {\n //BUS_FIRST_DAY_AWAY\n if( $BUS_FIRST_DAY_AWAY_Date ) {\n $requestBusiness = new VacReqRequestBusiness();\n $request->setRequestBusiness($requestBusiness);\n\n $requestBusiness->setStartDate($BUS_FIRST_DAY_AWAY_Date);\n //BUS_LAST_DAY_AWAY\n $BUS_LAST_DAY_AWAY = $this->getValueByHeaderName('BUS_LAST_DAY_AWAY', $rowData, $headers); //24-OCT-12\n $BUS_LAST_DAY_AWAY_Date = $this->transformDatestrToDate($BUS_LAST_DAY_AWAY);\n $requestBusiness->setEndDate($BUS_LAST_DAY_AWAY_Date);\n\n //NUM_DAYS_OFFSITE\n $NUM_DAYS_OFFSITE = $this->getValueByHeaderName('NUM_DAYS_OFFSITE', $rowData, $headers);\n $requestBusiness->setNumberOfDays($NUM_DAYS_OFFSITE);\n\n //ESTIMATED_EXPRESSES\n $ESTIMATED_EXPRESSES = $this->getValueByHeaderName('ESTIMATED_EXPRESSES', $rowData, $headers);\n $requestBusiness->setExpenses($ESTIMATED_EXPRESSES);\n\n //TRIP_PAID_BY_OUTSIDE\n $TRIP_PAID_BY_OUTSIDE = $this->getValueByHeaderName('TRIP_PAID_BY_OUTSIDE', $rowData, $headers);\n if( $TRIP_PAID_BY_OUTSIDE ) {\n $requestBusiness->setPaidByOutsideOrganization(true);\n }\n\n //DESCRIPTION\n $DESCRIPTION = $this->getValueByHeaderName('DESCRIPTION', $rowData, $headers);\n if( $DESCRIPTION ) {\n $requestBusiness->setDescription($DESCRIPTION);\n }\n\n //BUS_REQUEST_STATUS_ID\n $BUS_REQUEST_STATUS_ID = $this->getValueByHeaderName('BUS_REQUEST_STATUS_ID', $rowData, $headers);\n $BUS_REQUEST_STATUS = $this->statusMapper($BUS_REQUEST_STATUS_ID);\n if( $BUS_REQUEST_STATUS ) {\n $requestBusiness->setStatus($BUS_REQUEST_STATUS);\n }\n }\n }\n\n //VACATION_REQUEST\n $VACATION_REQUEST = $this->getValueByHeaderName('VACATION_REQUEST', $rowData, $headers);\n if( $VACATION_REQUEST ) {\n\n //VAC_FIRST_DAY_AWAY\n if( $VAC_FIRST_DAY_AWAY_Date ) {\n $requestVacation = new VacReqRequestVacation();\n $request->setRequestVacation($requestVacation);\n\n $requestVacation->setStartDate($VAC_FIRST_DAY_AWAY_Date);\n //VAC_LAST_DAY_AWAY\n $VAC_LAST_DAY_AWAY = $this->getValueByHeaderName('VAC_LAST_DAY_AWAY', $rowData, $headers); //24-OCT-12\n $VAC_LAST_DAY_AWAY_Date = $this->transformDatestrToDate($VAC_LAST_DAY_AWAY);\n $requestVacation->setEndDate($VAC_LAST_DAY_AWAY_Date);\n\n //VAC_DAYS_REQUESTED\n $VAC_DAYS_REQUESTED = $this->getValueByHeaderName('VAC_DAYS_REQUESTED', $rowData, $headers);\n $requestVacation->setNumberOfDays($VAC_DAYS_REQUESTED);\n\n// //FIRST_BACK_OFFICE\n// $FIRST_BACK_OFFICE = $this->getValueByHeaderName('FIRST_BACK_OFFICE', $rowData, $headers); //24-OCT-12\n// $FIRST_BACK_OFFICE_Date = $this->transformDatestrToDate($FIRST_BACK_OFFICE);\n// $requestVacation->setFirstDayBackInOffice($FIRST_BACK_OFFICE_Date);\n\n //VAC_REQUEST_STATUS_ID\n $VAC_REQUEST_STATUS_ID = $this->getValueByHeaderName('VAC_REQUEST_STATUS_ID', $rowData, $headers);\n $VAC_REQUEST_STATUS = $this->statusMapper($VAC_REQUEST_STATUS_ID);\n if( $VAC_REQUEST_STATUS ) {\n $requestVacation->setStatus($VAC_REQUEST_STATUS);\n }\n\n }\n\n }\n\n //APPROVER_ID\n $APPROVER_ID = $this->getValueByHeaderName('APPROVER_ID', $rowData, $headers);\n $approver = $this->getApproverByUserId($APPROVER_ID);\n if( $approver ) {\n\n $request->setApprover($approver);\n\n //DATE_APPROVED_REJECTED\n $DATE_APPROVED_REJECTED = $this->getValueByHeaderName('DATE_APPROVED_REJECTED', $rowData, $headers);\n $DATE_APPROVED_REJECTED_Date = $this->transformDatestrToDate($DATE_APPROVED_REJECTED);\n $request->setApprovedRejectDate($DATE_APPROVED_REJECTED_Date);\n\n //set organizational group\n $institution = null;\n //process.py script: replaced namespace by ::class: ['AppUserdirectoryBundle:User'] by [User::class]\n $roles = $em->getRepository(User::class)->findUserRolesBySiteAndPartialRoleName($approver,\"vacreq\",\"ROLE_VACREQ_APPROVER\");\n if( count($roles) > 0 ) {\n $role = $roles[0];\n //$note = 'ROLE_VACREQ_APPROVER role='.$role;\n //$logger->notice($note);\n $institution = $role->getInstitution();\n } else {\n $error = 'ROLE_VACREQ_APPROVER not found for approver='.$approver;\n $logger->error($error);\n }\n if( $institution ) {\n $request->setInstitution($institution);\n\n //assign submitter organizational group the same as approver\n //process.py script: replaced namespace by ::class: ['AppUserdirectoryBundle:User'] by [User::class]\n $roles = $em->getRepository(User::class)->findRolesBySiteAndPartialRoleName(\"vacreq\",\"ROLE_VACREQ_SUBMITTER\",$institution);\n if( count($roles) > 0 ) {\n $role = $roles[0];\n $roleName = $role->getName();\n $submitter->addRole($roleName);\n //exit($submitter.': added role '.$roleName);\n } else {\n $error = 'Submitter roles not found for exportId='.$exportId . \"; APPROVER_ID=\".$APPROVER_ID;\n $logger->error($error);\n throw new \\Exception( $error );\n }\n\n } else {\n $error = 'Organizational group not found for exportId='.$exportId . \"; APPROVER_ID=\".$APPROVER_ID;\n $logger->error($error);\n throw new \\Exception( $error );\n }\n\n } else {\n $error = 'Approver not found for exportId='.$exportId . \"; APPROVER_ID=\".$APPROVER_ID;\n $logger->error($error);\n throw new \\Exception( $error );\n }\n\n //DATE_REQUESTED\n $DATE_REQUESTED = $this->getValueByHeaderName('DATE_REQUESTED', $rowData, $headers);\n $DATE_REQUESTED_Date = $this->transformDatestrToDate($DATE_REQUESTED);\n $request->setCreateDate($DATE_REQUESTED_Date);\n\n // Not used, but existing fields in the old site\n //REQUEST_STATUS_ID\n $REQUEST_STATUS_ID = $this->getValueByHeaderName('REQUEST_STATUS_ID', $rowData, $headers);\n $REQUEST_STATUS = $this->statusMapper($REQUEST_STATUS_ID);\n if( $REQUEST_STATUS ) {\n $request->setStatus($REQUEST_STATUS);\n }\n\n //FINAL_FIRST_DAY_AWAY\n $FINAL_FIRST_DAY_AWAY = $this->getValueByHeaderName('FINAL_FIRST_DAY_AWAY', $rowData, $headers); //24-OCT-12\n $FINAL_FIRST_DAY_AWAY_Date = $this->transformDatestrToDate($FINAL_FIRST_DAY_AWAY);\n $request->setFirstDayAway($FINAL_FIRST_DAY_AWAY_Date);\n\n //FINAL_FIRST_DAY_BACK\n $FINAL_FIRST_DAY_BACK = $this->getValueByHeaderName('FINAL_FIRST_DAY_BACK', $rowData, $headers); //24-OCT-12\n $FINAL_FIRST_DAY_BACK_Date = $this->transformDatestrToDate($FINAL_FIRST_DAY_BACK);\n $request->setFirstDayBackInOffice($FINAL_FIRST_DAY_BACK_Date);\n\n //COMMENTS\n $COMMENTS = $this->getValueByHeaderName('COMMENTS', $rowData, $headers);\n $request->setComment($COMMENTS);\n\n //UPDATE_COMMENTS\n $UPDATE_COMMENTS = $this->getValueByHeaderName('UPDATE_COMMENTS', $rowData, $headers);\n $request->setUpdateComment($UPDATE_COMMENTS);\n\n\n $em->persist($request);\n $em->flush();\n\n// if( $VACATION_REQUEST && $BUSINESS_REQUEST ) {\n// exit('finished exportId=' . $exportId);\n// }\n\n $count++;\n\n //echo \"<br>\";\n\n }//for each request\n\n //echo \"finished looping<br><br>\";\n\n //process not existing users\n //print_r($notExistingUsers);\n //echo \"not existing users = \".count($notExistingUsers).\"<br>\";\n foreach( $notExistingUsers as $email=>$newestDate ) {\n $warning = \"not existing user email=\".$email.\"; newestDate=\".$this->convertDateTimeToStr($newestDate);\n //echo $warning.\"<br>\";\n $logger->warning($warning);\n }\n\n //exit('1');\n\n $result = \"Imported requests = \" . $count;\n return $result;\n }", "public function createEntidades(){\n\t\tforeach($this->tableNames as $tableSchema => $table){\n\t\t\t$entidade = array();\n\t\t\t\n\t\t\t$entidade[\"tabela\"] = $tableSchema;\n\t\t\t$entidade[\"tabela_view\"] = $tableSchema;\n\t\t\t$entidade[\"tabseq\"] = null;\n\t\t\t$entidade[\"colunafilho\"] = substr($tableSchema,0,3).\"seq\";\n\t\t\t\n\t\t\t$retInsert = $this->insertKrs(\"tabelas\", $entidade);\n\t\t\t\n\t\t\t$this->entidades[$tableSchema] = array(\"tabseq\"=>$retInsert['seq']);\n\t\t}\n\t\t\n\t}", "public function financas_inserir(){\r\n \r\n //data_hora_brasil_eua()\r\n $valor = \\anti_injection($_POST[\"valor\"]);\r\n $user = (int) $_POST[\"user\"];\r\n $obs = \\anti_injection($_POST[\"obs\"]);\r\n $sucesso = $this->_Modelo->MovExt_Inserir($user,$valor,$obs,1);\r\n $this->Main();\r\n if($sucesso===true){\r\n $mensagens = array(\r\n \"tipo\" => 'sucesso',\r\n \"mgs_principal\" => __('Depositado com Sucesso'),\r\n \"mgs_secundaria\" => 'Valor: '.$valor\r\n );\r\n $this->_Visual->Json_Info_Update('Titulo', __('Depositado com Sucesso'));\r\n }else{\r\n $mensagens = array(\r\n \"tipo\" => 'erro',\r\n \"mgs_principal\" => __('Erro'),\r\n \"mgs_secundaria\" => __('Erro')\r\n );\r\n $this->_Visual->Json_Info_Update('Titulo', __('Erro ao Depositar'));\r\n }\r\n $this->_Visual->Json_IncluiTipo('Mensagens',$mensagens); \r\n // ORGANIZA E MANDA CONTEUDO\r\n $this->_Visual->Json_Info_Update('Historico',0); \r\n }", "public function addapaimport($numLigne)\n {\n require_once(\"modules\".DIRECTORY_SEPARATOR.\"entities\".DIRECTORY_SEPARATOR.\"class\".DIRECTORY_SEPARATOR.\"class_manage_entities.php\");\n $func = new functions();\n $ent = new entity();\n\n $alert = false;\n\n require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php');\n $req = new request();\n $creationdate = $req->current_datetime();\n //$creationdate = date('Y-m-d H:i:s');\n\n //Format the date to database format\n $databaseformat_destructdate = $func->format_date_db($_SESSION['apa']['import']['destructdate']);\n $databaseformat_allowdate = $func->format_date_db($_SESSION['apa']['import']['allowdate']);\n\n\n //If the container field is not empty\n if (isset($_SESSION['apa']['import']['numuc']) && !empty($_SESSION['apa']['import']['numuc']))\n {\n //If the destruction date is the same for all ua in uc\n if( !$this->checkdestructdate($_SESSION['apa']['import']['numuc'], $databaseformat_destructdate))\n {\n $_SESSION['import']['error'] .=_MANAGE_APA_UA_DIFFERENT_DATE.' &lt;'._MANAGE_APA_IMPORT_LINE_NUM.$numLigne.'&gt;'.\"<br/>\";\n }\n\n //If the container dont exist we create it\n // getParentEntityId($entity_id) // isEnabledEntity($entity_id) // getTabChildrenId($parent = '', $where = '', $immediate_children_only = false)\n // $_SESSION['user']['primaryentity']['id']\n $_SESSION['apa']['import']['consEntityId'] = '';\n if($ent->getParentEntityId($_SESSION['apa']['import']['cusEntityId']) == $_SESSION['user']['primaryentity']['id']){\n $_SESSION['apa']['import']['consEntityId'] = $_SESSION['user']['primaryentity']['id'];\n if(!$this->checkarcontainer($_SESSION['apa']['import']['numuc'], $_SESSION['apa']['import']['consEntityId']))\n {\n $this->query(\"insert into \".$_SESSION['tablename']['apa_containers'].\" (entity_id, arcontainer_id, status, ctype_id, creation_date, retention_time) values ('\".$_SESSION['apa']['import']['consEntityId'].\"', '\".$_SESSION['apa']['import']['numuc'].\"','APA', '\".$_SESSION['apa']['import']['ctypeid'] .\"', '\".$creationdate.\"', '\".$databaseformat_destructdate.\"')\");\n\n $_SESSION['import']['uc_created']++;\n }\n else{\n //The container exist, check if the user can use it\n if(!$this->accessarcontainer($_SESSION['apa']['import']['numuc']))\n {\n $_SESSION['import']['error'] .=_MANAGE_APA_UC_NO_ACCESS.' &lt;'._MANAGE_APA_IMPORT_LINE_NUM.$numLigne.'&gt;'.\"<br/>\";\n $alert = true;\n }\n }\n }\n else{\n $_SESSION['import']['error'] .=_MANAGE_APA_UC_NO_ACCESS.' &lt;'._MANAGE_APA_IMPORT_LINE_NUM.$numLigne.'&gt;'.\"<br/>\";\n $alert = true;\n }\n }\n\n //If user have access right for uc\n if(!$alert)\n {\n $this->query(\"insert into \".$_SESSION['tablename']['apa_boxes'].\" (arbox_id, title, description, entity_id, arcontainer_id, status,\n creation_date, retention_time, custom_t3, custom_t2)\n values\n ('', 'APA_IMPORT', '\".$func->protect_string_db($_SESSION['apa']['import']['ardesc']).\"', '\".$_SESSION['apa']['import']['cusEntityId'].\"',\n '\".$_SESSION['apa']['import']['numuc'].\"', 'CLO', '\".$creationdate.\"', '\".$databaseformat_destructdate.\"',\n '\".$_SESSION['user']['UserId'].\"', 'APA')\");\n\n $sequence_name = 'arbox_id_seq';\n $numUa = $this->last_insert_id($sequence_name);\n $_SESSION['import']['ua_created']++;\n }\n /*if(!$alert)\n {\n // if the UA is filled\n if (isset($_SESSION['apa']['import']['numua']) && !empty($_SESSION['apa']['import']['numua']))\n {\n echo 'premier pas pour les UC'; die;\n //If the archiv box dont exist we create it\n if(!$this->checkarbox($_SESSION['apa']['import']['numua']))\n {\n $this->query(\"insert into \".$_SESSION['tablename']['apa_boxes'].\" (arbox_id, title, description, entity_id, arcontainer_id, status,\n creation_date, retention_time, custom_t3, custom_t2)\n values\n ('\".$_SESSION['apa']['import']['numua'].\"', 'APA\".$_SESSION['apa']['import']['numua'].\"',\n '\".$func->protect_string_db($_SESSION['apa']['import']['ardesc']).\"', '\".$_SESSION['apa']['import']['cusEntityId'].\"',\n '\".$_SESSION['apa']['import']['numuc'].\"', 'NEW', '\".$creationdate.\"', '\".$databaseformat_destructdate.\"',\n '\".$_SESSION['user']['UserId'].\"', 'APA')\");\n\n //Get the las insert ID of ar_boxes\n if (empty($_SESSION['apa']['import']['numua']))\n {\n $_SESSION['apa']['import']['numua'] = $this->last_insert_id();\n }\n\n //$_SESSION['import']['error'] .=_MANAGE_APA_UA_CREATED.\"<br/>\";\n $_SESSION['import']['ua_created']++;\n }\n else\n {\n //The archiv box exist, check if the user can use it\n if(!$this->accessarbox($_SESSION['apa']['import']['numua']))\n {\n $_SESSION['import']['error'] .=_MANAGE_APA_UA_NO_ACCESS.' &lt;'._MANAGE_APA_IMPORT_LINE_NUM.$numLigne.'&gt;'.\"<br/>\";\n $alert = true;\n }\n else\n {\n //Verify if a header with same box exist\n if($this->archivealreadyexist($_SESSION['apa']['import']['numua']))\n {\n $_SESSION['import']['error'] .=_WARNING_ALREADY_EXIST_ARCHIVE.' &lt;'._MANAGE_APA_IMPORT_LINE_NUM.$numLigne.'&gt;'.\"<br/>\";\n $alert = true;\n }\n }\n }\n }\n }*/\n\n if(!$alert)\n {\n //Create header\n $this->query(\"insert into \".$_SESSION['tablename']['apa_header'].\" (\n creation_date, ctype_id, year_1, year_2, destruction_date, allow_transmission_date,\n header_desc, entity_id, arnature_id, arbox_id, arcontainer_id)\n values(\n '\".$creationdate.\"', '\".$_SESSION['apa']['import']['ctypeid'] .\"','\".$_SESSION['apa']['import']['year1'] .\"',\n '\".$_SESSION['apa']['import']['year2'] .\"',\n '\".$databaseformat_destructdate.\"','\".$databaseformat_allowdate.\"',\n '\".$func->protect_string_db($_SESSION['apa']['import']['ardesc']).\"', '\".$_SESSION['apa']['import']['cusEntityId'].\"',\n '\".$_SESSION['apa']['import']['arnatureid'].\"', '\".$numUa.\"', '\".$_SESSION['apa']['import']['numuc'].\"')\");\n\n $sequence_name = 'ar_header_header_id_seq';\n $last_insert_id = $this->last_insert_id($sequence_name); //!!!!!!!!\n\n //If the header container is already positionned we update the arbox status\n $tabUC = array();\n $tabUC = $this->containerposition($_SESSION['apa']['import']['numuc'], $_SESSION['apa']['import']['cusEntityId']);\n if (count($tabUC) >0)\n {\n //Update the arbox status\n $this->query(\"update \".$_SESSION['tablename']['apa_boxes'].\" set status = 'POS' where arbox_id = '\".$numUa.\"'\");\n\n //Update the site in header\n $this->query(\"update \".$_SESSION['tablename']['apa_header'].\" set site_id = '\".$tabUC['site'].\"' where header_id = '\".$last_insert_id.\"'\");\n }\n\n //History\n if($_SESSION['history']['archiveadd'] == \"true\")\n {\n require_once(\"core\".DIRECTORY_SEPARATOR.\"class\".DIRECTORY_SEPARATOR.\"class_history.php\");\n $hist = new history();\n $hist->add($_SESSION['tablename']['apa_header'], $last_insert_id ,\"ADD\", 'archiveadd',\n _MANAGE_APA_HEADER_ADDED.\": \".$numUa.\"/\".$_SESSION['apa']['import']['numuc'], $_SESSION['config']['databasetype'], 'advanced_physical_archive');\n }\n\n $_SESSION['import']['header_add']++;\n $this->clearapaimportinfos();\n }\n }", "function import() {\n Configure::write('debug', 0);\n $id = $this->Avisosrepuesto->id;\n $this->set('avisosrepuesto', $this->Avisosrepuesto->find('first', array('contain' => array('Albaranescliente' => 'Cliente', 'Presupuestosproveedore' => 'Proveedore', 'Presupuestoscliente' => 'Cliente', 'ArticulosAvisosrepuesto' => 'Articulo', 'Cliente', 'Centrostrabajo', 'Maquina', 'Almacene', 'Estadosaviso'), 'conditions' => array('Avisosrepuesto.id' => $id))), 'estadosaviso');\n // echo \"id= \". $this->Avisosrepuesto->id . \"<br />\"; \n//Upload File\n if (isset($_POST['idAviso'])) {\n $id = $_POST['idAviso'];\n }\n if (isset($_POST['idAlmacene'])) {\n $idAlmacen = $_POST['idAlmacene'];\n }\n\n if (isset($_POST['submit'])) {\n\n if (is_uploaded_file($_FILES['filename']['tmp_name'])) {\n //echo \"<h1>\" . \"El fichero \" . $_FILES['filename']['name'] . \" uploaded successfully.\" . \"</h1>\";\n $resultadoUpload = \"El fichero <b>\" . $_FILES['filename']['name'] . \"</b> subido con éxito. <br />\";\n /* echo \"<h2>Displaying contents:</h2>\";\n readfile($_FILES['filename']['tmp_name']); */\n }\n //Import uploaded file to Database en modo Lectura\n $handle = fopen($_FILES['filename']['tmp_name'], \"r\");\n $cntRegistros = 0;\n $cntInsert = 0;\n $cntNoProcede = 0;\n $resultadoIncidencias = \"<ol>\";\n $flag = true; // para saltar la cabecera\n while (($data = fgetcsv($handle, 1000, \";\")) !== FALSE) {\n if ($flag) {\n $flag = false;\n continue;\n }\n $cntRegistros ++;\n // buscados el idArticulo por la referencia\n $consulta = sprintf(\"SELECT id, count(*) as total FROM articulos \n WHERE UPPER(ref) LIKE UPPER('%s') \n AND almacene_id = %s\", '%' . mysql_real_escape_string($data[0]) . '%', $idAlmacen);\n\n// Ejecutar la consulta\n $resultadoSQL = mysql_query($consulta);\n if (!$resultadoSQL) {\n $mensaje = 'Consulta no válida: ' . mysql_error() . '. Consulta completa: ' . $consulta;\n die($mensaje);\n }\n\n //$resultado .= $consulta . '<br />';\n // echo $consulta . ' id= ' . $dataSQL['id'] . ' total= ' . $dataSQL['total'] . '<br />';\n $dataSQL = mysql_fetch_assoc($resultadoSQL);\n //echo \"Registros con ref \" . $data[0] . \" coincide = \" . $dataSQL['total'] . '<br />';\n // Depende del resultado obtenido \n $articulo_id = $dataSQL['id'];\n\n switch ($dataSQL['total']) {\n case 0:\n $resultadoIncidencias .= sprintf(\"<li> Referencia = %s ,\"\n . \" <span style='color:red;font-weight:bold'> NO existe </span> como articulo en el Sistema.</li>\"\n , $data[0] );\n $cntNoProcede ++;\n break;\n case 1:\n $insertOrUpdate = \"INSERT INTO articulos_avisosrepuestos (avisosrepuesto_id, articulo_id, cantidad) \"\n . \"values('$id','$articulo_id', '$data[1]')\";\n $cntInsert ++;\n break;\n default :\n $resultadoIncidencias .= sprintf(\"<li> Referencia = %s, \"\n . \"<span style='color:red;font-weight:bold'>, Coincide más de un articulo </span> con esta referencia \"\n . '. Comprobar = %s </li>'\n , $data[0], $consulta);\n $cntNoProcede ++;\n } // switch \n\n if (strlen($insertOrUpdate) > 0) {\n $resultado2SQL = mysql_query($insertOrUpdate);\n if (!$resultado2SQL) {\n $mensaje = 'Consulta no válida: ' . mysql_error() . \"\\n\";\n $mensaje .= 'Consulta completa: ' . $insertOrUpdate;\n die($mensaje);\n }\n }\n $insertOrUpdate = \"\";\n } // While\n fclose($handle);\n\n $resultadoResumen = \" Total de registros analizados : \" . $cntRegistros . '<br />'\n . \" Articulos creados en el aviso : \" . $cntInsert . '<br />'\n . \" Registros NO procesados por incidencias : \" . $cntNoProcede;\n\n $this->set('resultadoUpload', isset($resultadoUpload) ? $resultadoUpload : \" \" );\n $this->set('resultadoResumen', isset($resultadoResumen) ? $resultadoResumen : \" \" );\n $this->set('resultado', (isset($resultadoIncidencias) ? $resultadoIncidencias : \" \" ) . \"</ol>\");\n $this->Session->setFlash(__('Importación finalizada con éxito .', true));\n } else {\n $this->set('resultadoResumen', \"\");\n $this->set('resultadoUpload', \"No hay fichero a subir\");\n }\n }", "public function import(ExcelUploadRequest $request) \n {\n $errores=[];\n DB::beginTransaction();\n try {\n //funcionando\n $array =Excel::toArray(new UsersImport, request()->file('archivo'));\n $array = $array[0];\n \n $rules = [\n 'email' => 'email|unique:users',\n 'nombre' => 'required',\n 'primer_apellido' => 'required',\n 'password' => 'required',\n ];\n \n $re =[];\n foreach($array as $key => $row)\n {\n $arrayAux = array_filter($row);\n if(!empty($arrayAux)){\n $validator = Validator::make( $row, $rules );\n if ($validator->fails()) {\n $re[] = [['Renglon: '.((int)$key+2)],$validator->messages()->all()];\n }\n else{\n $user = new User([\n 'nombre' => $row['nombre'],\n 'email' => $row['email'],\n 'password' => bcrypt($row['password']),\n 'primer_apellido' => $row['primer_apellido'], \n 'segundo_apellido' => $row['segundo_apellido'], \n 'id_institucion' => $row['id_institucion'],\n 'id_semana' => $row['id_semana'],\n ]);\n $user->save();\n \n $alumno = new Alumno([\n 'id_usuario'=>User::select('id')->where('email','=',$user->email)->get()[0]->id,\n 'id_programa'=>Programa::select('id')->where('id_programa','=',$row['programa'])->get()[0]->id,\n 'semestre'=>$row['semestre'],\n 'num_control'=>$row['num_control'],\n ]);\n $alumno->save();\n /*\n $r = new Rol([\n 'id_rol' => 2,\n 'creada_por' => 1,\n ]);\n */\n $user->roles()->attach([$user->id => ['id_rol'=>'2', 'creada_por'=>'1']]);\n }\n }\n }\n if(empty($re)) {\n DB::commit();\n return back()->with('bien', 'Alumnos registrados exitosamente');\n }\n else{\n DB::rollback();\n return back()->with('errores',$re);\n }\n } \n catch (Exception $e) {\n DB::rollback();\n return back()->withErrors($e->errors());\n }\n\n }", "function importer_spip_partenaires_types() {\n\n\t######## VERIFIEZ LE NOM DE LA TABLE D'INSERTION ###########\n\t$table = 'spip_partenaires_types';\n\n\t// nom_du_champ_source => nom_du_champ_destination\n\t// mettre vide la destination ou supprimer la ligne permet de ne pas importer la colonne.\n\t$correspondances = array(\n\t\t'id_type' => 'id_type',\n\t\t'titre' => 'titre',\n\t\t'descriptif' => 'descriptif',\n\t\t'maj' => 'maj',\n\t);\n\n\t// transposer les donnees dans la nouvelle structure\n\t$inserts = array();\n\tlist($cles, $valeurs) = donnees_spip_partenaires_types();\n\t// on remet les noms des cles dans le tableau de valeur\n\t// en s'assurant de leur correspondance au passage\n\tif (is_array($valeurs)) {\n\t\tforeach ($valeurs as $v) {\n\t\t\t$i = array();\n\t\t\tforeach ($v as $k => $valeur) {\n\t\t\t\t$cle = $cles[$k];\n\t\t\t\tif (isset($correspondances[$cle]) and $correspondances[$cle]) {\n\t\t\t\t\t$i[ $correspondances[$cle] ] = $valeur;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$inserts[] = $i;\n\t\t}\n\t\tunset($valeurs);\n\n\t\t// inserer les donnees en base.\n\t\t$nb_inseres = 0;\n\t\t// ne pas reimporter ceux deja la (en cas de timeout)\n\t\t$nb_deja_la = sql_countsel($table);\n\t\t$inserts = array_slice($inserts, $nb_deja_la);\n\t\t$nb_a_inserer = count($inserts);\n\t\t// on decoupe en petit bout (pour reprise sur timeout)\n\t\t$inserts = array_chunk($inserts, 100);\n\t\tforeach ($inserts as $i) {\n\t\t\tsql_insertq_multi($table, $i);\n\t\t\t$nb_inseres += count($i);\n\t\t\t// serie_alter() relancera la fonction jusqu'a ce que l'on sorte sans timeout.\n\t\t\tif (time() >= _TIME_OUT) {\n\t\t\t\t// on ecrit un gentil message pour suivre l'avancement.\n\t\t\t\techo \"<br />Insertion dans $table relanc&eacute;e : \";\n\t\t\t\techo \"<br />- $nb_deja_la &eacute;taient d&eacute;j&agrave; l&agrave;\";\n\t\t\t\techo \"<br />- $nb_inseres ont &eacute;t&eacute; ins&eacute;r&eacute;s.\";\n\t\t\t\t$a_faire = $nb_a_inserer - $nb_inseres;\n\t\t\t\techo \"<br />- $a_faire &agrave; faire.\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n}", "public function tipo_importacion(){\n\n //datos comunes de las vistas\n $datos_vista = $this->cargar_datos();\n\n //definimos el paso en que nos encotramos\n $datos_vista['paso'] = 'tipo-importacion';\n\n //tipos de importacion queda definido por el logo de la pagina desde donde se ha exportado el archivo\n $datos_vista['logos-importar-entradas'] = $this->imagenes_importar_entradas();\n\n return return_vistas('blogs.importar-entradas', $datos_vista); \n }", "public function run()\n {\n DB::table('lancamentos')->delete();\n\n $dbFile = file_get_contents(__DIR__ . '/../../db.csv');\n $insert = [];\n foreach (explode(\"\\n\", $dbFile) as $lineStr) {\n $line = explode(\";\", $lineStr);\n LancamentosModel::create([\n 'id' => $line[0],\n 'data_lancamento' => $line[1],\n 'hora_lancamento' => $line[2],\n 'estabelecimento' => $line[3],\n 'categoria_estabelecimento' => $line[4],\n 'latitude_estabelecimento' => $line[5],\n 'longitude_estabelecimento' => $line[6],\n 'taxa_pontuacao' => $line[7],\n 'valor_lancamento' => $line[8],\n ]);\n }\n }", "static public function mdlIngresarOsde($tabla, $datos){\n\n\t\t$stmt = Conexion::conectar()->prepare(\"INSERT INTO $tabla(nombre,importe) VALUES (:nombre,:importe)\");\n\n\t\t$stmt -> bindParam(\":nombre\", $datos[\"nombre\"], PDO::PARAM_STR);\n\t\t$stmt -> bindParam(\":importe\", $datos[\"importe\"], PDO::PARAM_STR);\n\n\t\tif($stmt->execute()){\n\n\t\t\treturn \"ok\";\n\n\t\t}else{\n\n\t\t\treturn \"error\";\n\t\t\n\t\t}\n\n\t\t$stmt->close();\n\t\t$stmt = null;\n\n\t}", "public function saveFields()\n {\n $nome_arquivo = $this->arquivo;\n $array_insert = $this->readFile();\n\n if(!empty($array_insert))\n {\n array_shift($array_insert);\n Yii::$app->db->createCommand()->batchInsert(\n 'alimentos', \n ['descricao', 'medida_caseira', 'calorias', 'grupo_id'],\n $array_insert\n )->execute();\n\n $this->total_insert = count($array_insert);\n }\n\n }", "public function importar(){\n\n\t\t//Cargar librería upload con los siguientes parámetros\n\t\t$config['upload_path'] = './uploads/';\n\t\t$config['allowed_types'] = 'csv';\n\t\t$config['max_size'] = '1000000000';\n\t\t$this->load->library('upload', $config);\n\t\t$this->upload->initialize($config);\t\n\n\t\t//Cargar modelo atenciones\n\t\t$this->load->model('atenciones');\n\t\t\n\n\t\t\n\t\t$filename = $_FILES['archivo_csv']['name'];\t\n\t\t// En el caso que se suba un archivo repetido se elimina el anterior. \n\t\tif (!empty($filename)) {\n\t\t\tif (file_exists('./uploads/'.$filename)){\n\t\t\t\tunlink('./uploads/'.$filename);\n\t\t\t}\t\n\t\t}\n\t\t\t\n\t\t// Se sube el archivo CSV\n\t\t if (!$this->upload->do_upload('archivo_csv'))\n {\n \t$error = array('error' => $this->upload->display_errors());\n //$this->load->view('debug', $error);\n //var_dump($error);\n }\n\n else{\n\n \t// Se eliminan todos los registros anteroriores de la tabla atenciones.\n \t$this->atenciones->delete_all_atenciones();\n\n \t// Se lee el archivo subido y se agregan a la base de datos.\n \t$handle = fopen('./uploads/'.$filename, \"r\");\t\n \t\n\n \t//Variables para controlar cantidad de datos que van al batch para insertar.\n \t$data_batch = array();\n \t$limitador_batch = 100000;\n\n\n \t// Se lee cada registro del archivo CSV.\n\n \t// Se agrega esta linea para leer \n \t$flag_first = true;\n \twhile (($data = fgetcsv($handle, 1000, \";\")) !== FALSE)\n {\n \tif ($flag_first){\n \t\t$flag_first = false;\n \t\tcontinue;\n \t}\n\n \t// code por si se desea agregar los registros por medio de batchs---\n\t\t array_push($data_batch,array(\n\t\t\t\t\t'id' => $data[0],\n\t\t\t\t\t'fecha' => $data[1],\n\t\t\t\t\t'id_forma_ingreso' => $data[2],\n\t\t\t\t\t'id_contacto_crm' => $data[3],\n\t\t\t\t\t'id_coordinadora_crm' => $data[4],\n\t\t\t\t\t'id_producto_agrupador' => $data[5],\n\t\t\t\t\t'id_oficina_comercial_crm' => $data[6],\n\t\t\t\t\t'deleted' => $data[7],\n\t\t\t\t\t));\n\n\n\t\t // Se agrega este limitador ya que agregar todos los registros en un lote genera desborde de memoria permitida en php. \n if (count($data_batch) > $limitador_batch){\n \t$this->atenciones->insert_atenciones_batch($data_batch);\n \t\t$data_batch = array();\n \t}\n\n\n\n \t//code por si se desea insertar los registros unitariamente----\n\n \t// //insert_atenciones($id,$fecha,$id_forma_ingreso,$id_contacto_crm,$id_coordinadora_crm,$id_producto_agrupador,$id_oficina_comercial_crm,$deleted)\n //$this->atenciones->insertar_atenciones($data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6],$data[7]);\n\n\n\n\n }\n\n if (count($data_batch) > 0){\n \t$this->atenciones->insert_atenciones_batch($data_batch);\n \t\t$data_batch = array();\n }\n }\n\n\t\t$data['cantidad_datos'] = $this->atenciones->get_all_rows();\t\n\t\t$this->load->view('inicio',$data);\n\t}", "public function ejecutarProcesoETL()\n {\n $etlAduana = new Etl;\n $etlAduana->extract('table', 'aduana',[\n 'connection'=>'transaccional',\n 'columns'=>['aduana_id','codigo_aduana','nombre_aduana']\n ]\n )\n ->transform('trim', ['columns' => ['aduana_id', 'codigo_aduana','nombre_aduana']])\n ->load('insert_update', 'aduana',[\n 'connection'=>'mysql',\n 'key'=>['aduana_id'],\n 'columns'=>['aduana_id','codigo_aduana','nombre_aduana'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla aduana*/\n\n /*ETL para tabla Proveedor*/\n $etlProveedor = new Etl;\n $etlProveedor->extract('table', 'proveedor',[\n 'connection'=>'transaccional',\n 'columns'=>['proveedor_id','nombre_proveedor']\n ]\n )\n ->transform('trim', ['columns' => ['proveedor_id','nombre_proveedor']])\n ->load('insert_update', 'proveedor',[\n 'connection'=>'mysql',\n 'key'=>['proveedor_id'],\n 'columns'=>['proveedor_id','nombre_proveedor'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla proveedor*/\n\n /*ETL para tabla Tipo_materia_prima*/\n $etlTipoMateriaPrima = new Etl;\n $etlTipoMateriaPrima->extract('table', 'tipo_materia_prima',[\n 'connection'=>'transaccional',\n 'columns'=>['tipo_materia_prima_id','nombre_tipo_materia_prima']\n ]\n )\n ->transform('trim', ['columns' => ['tipo_materia_prima_id','nombre_tipo_materia_prima']])\n ->load('insert_update', 'tipo_materia_prima',[\n 'connection'=>'mysql',\n 'key'=>['tipo_materia_prima_id'],\n 'columns'=>['tipo_materia_prima_id','nombre_tipo_materia_prima'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla Tipo_materia_prima*/ \n \n /*ETL para tabla Materia_prima*/\n $etlMateriaPrima = new Etl;\n $etlMateriaPrima->extract('table', 'materia_prima',[\n 'connection'=>'transaccional',\n 'columns'=>['materia_prima_id','tipo_materia_prima_id','nombre_materia_prima','existencias']\n ]\n )\n ->transform('trim', ['columns' => ['materia_prima_id','tipo_materia_prima_id','nombre_materia_prima','existencias']])\n ->load('insert_update', 'materia_prima',[\n 'connection'=>'mysql',\n 'key'=>['materia_prima_id'],\n 'columns'=>['materia_prima_id','tipo_materia_prima_id','nombre_materia_prima','existencias'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla Materia_prima*/ \n \n /*ETL para tabla Orden_de_compra*/\n $etlOrdenDeCompra = new Etl;\n $etlOrdenDeCompra->extract('table', 'orden_de_compra',[\n 'connection'=>'transaccional',\n 'columns'=>['orden_de_compra_id','proveedor_id','total_orden','fecha_emision_orden']\n ]\n )\n ->transform('trim', ['columns' => ['orden_de_compra_id','proveedor_id','total_orden','fecha_emision_orden']])\n ->load('insert_update', 'orden_de_compra',[\n 'connection'=>'mysql',\n 'key'=>['orden_de_compra_id'],\n 'columns'=>['orden_de_compra_id','proveedor_id','total_orden','fecha_emision_orden'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla Orden_de_compra*/ \n\n /*ETL para tabla Proceso_importacion*/\n $etlProcesoImportacion = new Etl;\n $etlProcesoImportacion->extract('table', 'proceso_importacion',[\n 'connection'=>'transaccional',\n 'columns'=>['proceso_importacion_id','fecha_ingreso_pedido','fecha_estimada_llegada','nombre_importacion']\n ]\n )\n ->transform('trim', ['columns' => ['proceso_importacion_id','fecha_ingreso_pedido','fecha_estimada_llegada','nombre_importacion']])\n ->load('insert_update', 'proceso_importacion',[\n 'connection'=>'mysql',\n 'key'=>['proceso_importacion_id'],\n 'columns'=>['proceso_importacion_id','fecha_ingreso_pedido','fecha_estimada_llegada','nombre_importacion'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla Proceso_importacion*/ \n\n /*ETL para tabla Declaracion*/\n $etlDeclaracion= new Etl;\n $etlDeclaracion->extract('table', 'declaracion',[\n 'connection'=>'transaccional',\n 'columns'=>['declaracion_id','aduana_id','proceso_importacion_id','pago_impuestos']\n ]\n )\n ->transform('trim', ['columns' => ['declaracion_id','aduana_id','proceso_importacion_id','pago_impuestos']])\n ->load('insert_update', 'declaracion',[\n 'connection'=>'mysql',\n 'key'=>['declaracion_id'],\n 'columns'=>['declaracion_id','aduana_id','proceso_importacion_id','pago_impuestos'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla Declaracion*/ \n\n /*ETL para tabla Documento_transporte*/\n $etlDocumentoTransporte= new Etl;\n $etlDocumentoTransporte->extract('table', 'documento_transporte',[\n 'connection'=>'transaccional',\n 'columns'=>['documento_transporte_id','declaracion_id','fecha_emision_doc','tipo_documento']\n ]\n )\n ->transform('trim', ['columns' => ['documento_transporte_id','declaracion_id','fecha_emision_doc','tipo_documento']])\n ->load('insert_update', 'documento_transporte',[\n 'connection'=>'mysql',\n 'key'=>['documento_transporte_id'],\n 'columns'=>['documento_transporte_id','declaracion_id','fecha_emision_doc','tipo_documento'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla Documento_transporte*/ \n\n /*ETL para tabla Factura*/\n $etlFactura= new Etl;\n $etlFactura->extract('table', 'factura',[\n 'connection'=>'transaccional',\n 'columns'=>['factura_id','declaracion_id','proveedor_id','total_factura','condiciones_pago','fecha_emision_factura']\n ]\n )\n ->transform('trim', ['columns' => ['factura_id','declaracion_id','proveedor_id','total_factura','condiciones_pago','fecha_emision_factura']])\n ->load('insert_update', 'factura',[\n 'connection'=>'mysql',\n 'key'=>['factura_id'],\n 'columns'=>['factura_id','declaracion_id','proveedor_id','total_factura','condiciones_pago','fecha_emision_factura'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla Factura*/ \n\n /*ETL para tabla Factura_materia_prima*/\n $etlFacturaMateriaPrima= new Etl;\n $etlFacturaMateriaPrima->extract('table', 'factura_materia_prima',[\n 'connection'=>'transaccional',\n 'columns'=>['factura_materia_prima_id','factura_id','materia_prima_id','total_materia_prima']\n ]\n )\n ->transform('trim', ['columns' => ['factura_materia_prima_id','factura_id','materia_prima_id','total_materia_prima']])\n ->load('insert_update', 'factura_materia_prima',[\n 'connection'=>'mysql',\n 'key'=>['factura_materia_prima_id'],\n 'columns'=>['factura_materia_prima_id','factura_id','materia_prima_id','total_materia_prima'],\n 'timestamps' => true\n ]\n )\n ->run();\n /*fin ETL de tabla Factura_materia_prima*/ \n \n return back()->with('success','La base de datos gerencial ha sido actualizada correctamente');\n }", "function insertarDepositos(){\n\n\n $this->procedimiento='vef.ft_depositos_ime';\n\t\t$this->transaccion='VF_CDO_INS';\n\t\t$this->tipo_procedimiento='IME';\n\n\n\n\t\t//Define los parametros para la funcion\n\t\t$this->setParametro('nro_deposito','nro_deposito','varchar');\n\t\t$this->setParametro('id_punto_venta','id_punto_venta','int4');\n\t\t$this->setParametro('codigo','codigo','varchar');\n\t\t$this->setParametro('nombre_sucursal','nombre_sucursal','varchar');\n\t\t$this->setParametro('id_usuario_cajero','id_usuario_cajero','int4');\n\t\t$this->setParametro('fecha_hora_cierre','fecha_hora_cierre','timestamp');\n\t\t$this->setParametro('cajero','cajero','text');\n\t\t$this->setParametro('nombre_punto_venta','nombre_punto_venta','varchar');\n\t\t$this->setParametro('id_entrega_brinks','id_entrega_brinks','int4');\n\t\t$this->setParametro('fecha_apertura_cierre','fecha_apertura_cierre','date');\n\t\t$this->setParametro('id_moneda','id_moneda','int4');\n\t\t$this->setParametro('monto_inicial_moneda_extranjera','monto_inicial_moneda_extranjera','numeric');\n\t\t$this->setParametro('arqueo_moneda_local','arqueo_moneda_local','numeric');\n\t\t$this->setParametro('fecha_venta','fecha_venta','date');\n\t\t$this->setParametro('id_sucursal','id_sucursal','int4');\n\t\t$this->setParametro('codigo_lugar','codigo_lugar','varchar');\n\t\t$this->setParametro('monto_inicial','monto_inicial','numeric');\n\t\t$this->setParametro('arqueo_moneda_extranjera','arqueo_moneda_extranjera','numeric');\n\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "function aplicar()\n\t{\n\t\tif (!$this->existe()) {\n\t\t\tthrow new toba_error(\"PERSONALIZACION: No existe la carpeta de personalización\");\n\t\t}\n\t\t\n\t\t//Instancio ambos importadores\n\t\t$importador_tablas = new toba_importador_tablas($this->dir_tablas.self::nombre_plan, $this->db);\n\t\t$importador_componentes = new toba_importador_componentes($this->dir_componentes.self::nombre_plan, $this->db);\t\t\n\t\t\n\t\t//Empiezo haciendo el chequeo de conflictos para los componentes\n\t\t//En una transaccion destinada a abortar\n\t\t//------------------------------------------------------------------------------------------//\n\t\t$this->db->abrir_transaccion();\n\t\t$this->analizar_conflictos($importador_tablas, false);\n\t\t$this->analizar_conflictos($importador_componentes, false);\n\t\t$this->db->abortar_transaccion();\n\t\t//------------------------------------------------------------------------------------------//\n\t\t\n\t\t//Comienzo la importacion propiamente dicha\t\t\n\t\tif ($this->ejecutar_en_transaccion_global()) {\t\t\t\n\t\t\t$this->db->abrir_transaccion();\t\t\t\t\t\n\t\t\t$this->db->retrasar_constraints();\t//Retraso los triggers para evitar problemas de fk\n\t\t}\t\t\n\t\t\n\t\t//Aplico la personalizacion a tablas y componentes\n\t\ttry {\n\t\t\t$this->aplicar_cambios($importador_tablas);\n\t\t\t$this->aplicar_cambios($importador_componentes);\n\t\t} catch (toba_error_db $e) {\n\t\t\t$this->db->abortar_transaccion();\t\t\t\t//Hubo problemas de SQL, aborto todo\n\t\t\tif ($this->consola) {\n\t\t\t\t$this->consola->mensaje(\"Ocurrio un error en la importacion \\n\");\n\t\t\t}\n\t\t} catch(toba_error_usuario $e) {\n\t\t\t$this->db->abortar_transaccion();\t\t\t\t//El usuario decidio no continuar, saco mensaje por pantalla\n\t\t\tif ($this->consola) {\n\t\t\t\t$this->consola->mensaje($e->getMessage());\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\tif ($this->db->transaccion_abierta() && $this->ejecutar_en_transaccion_global()) {\n\t\t\t$this->db->cerrar_transaccion();\t\t\t\t//Cierro la transaccion si aun esta abierta. Esto es, se ejecuto sin problemas\n\t\t}\n\t}", "public function ImportarHorarios()\n {\n try {\n $filtros = json_decode(file_get_contents(\"php://input\"), true);\n $dbm = new DbmControlescolar($this->get(\"db_manager\")->getEntityManager());\n $dbm->getConnection()->beginTransaction();\n\n foreach($filtros['data'] as $data){\n $prof = $dbm->getRepositorioById('CeProfesorpormateriaplanestudios', 'profesorpormateriaplanestudiosid', $data['profesorpormateriaplanestudiosid']);\n if(!$data['existe']){\n $horario = new CeHorario();\n $horario->setDia($data['Dia']);\n $horario->setSalon($data['Salon']);\n $horario->setHorainicio(new \\Datetime('1999-01-01 ' . $data['HoraInicio']));\n $horario->setHorafin(new \\Datetime('1999-01-01 ' . $data['HoraFin']));\n $horario->setProfesorpormateriaplanestudiosid($prof);\n $dbm->saveRepositorio($horario);\n }\n }\n $dbm->getConnection()->commit();\n return new View('Se han importado los horarios correctamente', Response::HTTP_OK);\n } catch (\\Exception $e) {\n return new View($e->getMessage(), Response::HTTP_BAD_REQUEST);\n }\n }", "public function saveAction() {\n $id = $this->params()->fromRoute('id', null);\n\n //Cria o formulário\n $form = new ImportacaoPontoForm($this->entityManager);\n\n $user = $this->entityManager->getRepository(Colaborador::class)->findOneByLoginLocal($this->identity()['login']);\n $dataAtual = new \\DateTime();\n\n //Verifica se a requisição utiliza o método POST\n if ($this->getRequest()->isPost()) {\n\n $post = array_merge($this->getRequest()->getPost()->toArray(), $this->getRequest()->getFiles()->toArray());\n $form->setData($post);\n\n //Recebe os dados via POST\n //$data = $this->params()->fromPost();\n //Preenche o form com os dados recebidos e o valida\n //$form->setData($data);\n if ($form->isValid()) {\n $data = $form->getData();\n\n $repo = $this->entityManager->getRepository(ImportacaoPonto::class);\n $folha_repo = $this->entityManager->getRepository(FolhaPonto::class);\n $feriado_repo = $this->entityManager->getRepository(Feriado::class);\n $constantes_mes_repo = $this->entityManager->getRepository(ConstantesMes::class);\n\n $importacaoPonto = $repo->incluir_ou_editar($data, $user, null, $id);\n\n $file = $this->params()->fromFiles('arquivo');\n $serviceImportacao = $this->getEvent()->getApplication()->getServiceManager()->get(\\SigRH\\Service\\FileUpload::class);\n $log = $serviceImportacao->uploadPonto($file, $importacaoPonto);\n\n $repo->incluir_ou_editar($data, $user, $log, $importacaoPonto->getId());\n $this->entityManager->flush();\n\n $referencia = $importacaoPonto->getReferencia();\n $mes = substr($referencia, 4, 2);\n $ano = substr($referencia, 0, 4);\n $folha_repo->complete($referencia);\n $numeroDiasMes = cal_days_in_month(CAL_GREGORIAN, $mes, $ano);\n $numeroDiasUteis = $numeroDiasMes;\n $feriados = $feriado_repo->getFeriadoReferencia($referencia);\n foreach ($feriados as $feriado) {\n if (($feriado->getExpediente() == 0) && ((int) $feriado->getDataFeriado()->format(\"N\") < 6) ) {\n $numeroDiasUteis -= 1;\n } else if ($feriado->getExpediente() >= 2) {\n $numeroDiasUteis -= 0.5;\n }\n }\n\n //busca o número de dias úteis no mês\n for ($dia = 1; $dia <= $numeroDiasMes; $dia++) {\n $dataConsulta = \\DateTime::createFromFormat(\"Ymd\", $referencia . $dia);\n $dataConsulta->setTime(0, 0);\n if ( $dataConsulta->format(\"N\") > 5 ) {\n $numeroDiasUteis -= 1;\n }\n }\n\n $dados['referencia'] = $referencia;\n $dados['ultimoDiaImportado'] = $data['ultimoDia'];\n $dados['numeroDiasUteis'] = $numeroDiasUteis;\n\n $constantes_mes_repo->incluir_ou_editar($dados);\n\n return $this->redirect()->toRoute('sig-rh/importacao-ponto', ['action' => 'index']);\n } else {\n print_r($form->getMessages());\n die();\n }\n } else {\n $form->get(\"usuario\")->setValue($user);\n// $form->get(\"dataImportacao\")->setValue($dataAtual->format(\"Y-m-d\"));\n $form->get(\"dataServidor\")->setValue($dataAtual->format(\"Y-m-d\"));\n\n if (!empty($id)) {\n $repo = $this->entityManager->getRepository(ImportacaoPonto::class);\n $row = $repo->find($id);\n if (!empty($row)) {\n $form->setData($row->toArray());\n }\n }\n }\n return new ViewModel([\n 'form' => $form\n ]);\n }", "public function Notas($usuario){\n\t\t\tif($_FILES['csv']['size']>0){\n\t\t\t\t$this->usuario=$usuario;\n\t\t\t\t$csv=$_FILES['csv']['tmp_name'];\n\t\t\t\t$handle=fopen($csv, 'r');\n\t\t\t\twhile($data=fgetcsv($handle, 1000, \";\", \"'\")){\n\t\t\t\t\t$sql=$this->db->query(\"SELECT id_escolar FROM escolar WHERE escolar='$data[3]' LIMIT 1;\");\n\t\t\t\t\t$escolar=$this->db->recorrer($sql);\n\t\t\t\t\t$this->db->liberar($sql);\n\t\t\t\t\t$sql=$this->db->query(\"SELECT id_grado FROM grado WHERE grado='$data[4]' LIMIT 1;\");\n\t\t\t\t\t$grado=$this->db->recorrer($sql);\n\t\t\t\t\t$this->db->liberar($sql);\n\t\t\t\t\t$sql=$this->db->query(\"SELECT id_seccion FROM seccion WHERE seccion='$data[5]' LIMIT 1;\");\n\t\t\t\t\t$seccion=$this->db->recorrer($sql);\n\t\t\t\t\t$this->db->liberar($sql);\n\t\t\t\t\t$sql=$this->db->query(\"SELECT * FROM notas WHERE id_alum=$data[0] AND escolar=$escolar[0] AND grado=$grado[0] AND seccion=$seccion[0] LIMIT 1;\");\n\t\t\t\t\tif($this->db->rows($sql)==0){\n\t\t\t\t\t\t$this->aprobo=strtolower($data[6]);\n\t\t\t\t\t\t$this->db->liberar($sql);\n\t\t\t\t\t\t$this->db->query(\"INSERT INTO notas(id_alum, escolar, grado, seccion, aprobo) VALUES($data[0], $escolar[0], $grado[0], $seccion[0], '$this->aprobo');\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$indicesServer = array('REMOTE_ADDR',);\n\t\t\t\t$ip=$_SERVER['REMOTE_ADDR'];\n\t\t\t\t$evento=\"Subio notas\";\n\t\t\t\t$this->db->query(\"INSERT INTO registro_eventos(ip, usuario, evento, fecha, operacion) VALUES('$ip', '$this->usuario', '$evento', NOW(), 'INSERT');\");\n\t\t\t\techo 'OK';\n\t\t\t}else{\n\t\t\t\theader('location: ?view=config&mode=Notas&error=2');\n\t\t\t}\n\t\t}", "public function importBaseflorAction(Request $request)\n\t{\n\n\t\t// retrieves ioHelpers service\n\t\t$ioHelpers = $this->get('eveg_app.io_helpers');\n\n\t\t// Creates the form...\n \t$form = $this->createFormBuilder()\n ->add('importFile', 'file')\n ->getForm();\n // ... and then hydrates it\n $form->handleRequest($request);\n\n // Job routine\n\t\tif($form->isValid()) {\n\n\t\t\t$batchSize = 100; // $entity will be flushed and detached each $batchSize time (prevent memory overload)\n\t\t\t$i = 0; // just an incremental\n\t\t\t$cycle = 0; // counts the number of batch cycles\n\n\t\t\t// Recovers the uploaded file\n\t\t\t$file = $form->get('importFile')->getData();\n\t\t\t$mimeType = $file->getMimeType();\n\t\t\t$clientOriginaFilelName = $file->getClientOriginalName();\n\n\t\t\t// File type verification\n\t\t\tif(($mimeType !== 'text/csv') && (FALSE == preg_match('/\\.csv/i', $clientOriginaFilelName))) {\n\t\t\t\tThrow new HttpException(400, \"The file must be a csv (the file MIME type should be 'text/csv' or the file name should contain '.csv').\");\n\t\t\t}\n\n\t\t\t// Moves the uploaded file\n\t\t\t$name = $file->getClientOriginalName();\n\t\t\t$rootDir = $this->get('kernel')->getRootDir();\n\t\t\t$dir = $rootDir.'/../web/uploads/import/biblio';\n\t\t\t$file->move($dir, $name);\n\n\t\t\t// Variables\n\t\t\t$import = $ioHelpers->csv_to_array($dir.'/'.$name, ';');\t\t// pushes the csv data into an array\n\t\t\t$countImports = 0;\n\n\t\t\t// Truncate the table\n\t\t\t$em = $this->getDoctrine()->getManager();\n\t\t\t$connection = $em->getConnection();\n\t\t\t$platform = $connection->getDatabasePlatform();\n\t\t\t$connection->executeUpdate($platform->getTruncateTableSQL('eveg_baseflor', true /* whether to cascade */));\n\t\t\t$em->clear();\n\n\t\t\t// Adding\n\t\t\tforeach ($import as $key => $importedRow) {\n\t\t\t\t$sp = new Baseflor;\n\t\t\t\t$sp\n\t\t\t\t\t->setTaxonomicRang($importedRow['taxonomic_rang'])\n\t\t\t\t\t->setCatminatCode($importedRow['catminat_code'])\n\t\t\t\t\t->setBdnffTaxinId($importedRow['bdnff_taxin_id'])\n\t\t\t\t\t->setBdnffNomenId($importedRow['bdnff_nomen_id'])\n\t\t\t\t\t->setScientificName($importedRow['scientific_name'])\n\t\t\t\t\t->setRepartition($importedRow['repartition'])\n\t\t\t\t\t->setInflorescence($importedRow['inflorescence'])\n\t\t\t\t\t->setSexuality($importedRow['sexuality'])\n\t\t\t\t\t->setPollination($importedRow['pollination'])\n\t\t\t\t\t->setFruit($importedRow['fruit'])\n\t\t\t\t\t->setDissemination($importedRow['dissemination'])\n\t\t\t\t\t->setFlowerColor($importedRow['flower_color'])\n\t\t\t\t\t->setMacula($importedRow['macula'])\n\t\t\t\t\t->setFlowering($importedRow['flowering'])\n\t\t\t\t\t->setWoodType($importedRow['wood_type'])\n\t\t\t\t\t->setMaxVegetativeHeight($importedRow['max_vegetative_height'])\n\t\t\t\t\t->setBiologicalType($importedRow['biological_type'])\n\t\t\t\t\t->setPlantFormation($importedRow['plant_formation'])\n\t\t\t\t\t->setEcologicalCharacterization($importedRow['ecological_characterization'])\n\t\t\t\t\t->setPhytoCharacteristicIndication($importedRow['phytosociological_characteristic_indication'])\n\t\t\t\t\t->setTransgressiveCharacteristicIndication($importedRow['transgressive_characteristic_indication'])\n\t\t\t\t\t->setDifferentialIndication1($importedRow['differential_indication_1'])\n\t\t\t\t\t->setDifferentialIndication2($importedRow['differential_indication_2'])\n\t\t\t\t\t->setDifferentialIndication3($importedRow['differential_indication_3'])\n\t\t\t\t\t->setPjLight($importedRow['pj_light'])\n\t\t\t\t\t->setPjTemperature($importedRow['pj_temperature'])\n\t\t\t\t\t->setPjContinentality($importedRow['pj_continentality'])\n\t\t\t\t\t->setPjAtmosphericHumidity($importedRow['pj_atmospheric_humidity'])\n\t\t\t\t\t->setPjSoilHumidity($importedRow['pj_soil_humidity'])\n\t\t\t\t\t->setPjSoilPh($importedRow['pj_soil_ph'])\n\t\t\t\t\t->setPjTrophicLevel($importedRow['pj_trophic_level'])\n\t\t\t\t\t->setPjSalinity($importedRow['pj_salinity'])\n\t\t\t\t\t->setPjTexture($importedRow['pj_texture'])\n\t\t\t\t\t->setPjOrganicMaterial($importedRow['pj_organic_material'])\n\t\t\t\t\t->setElLight($importedRow['el_light'])\n\t\t\t\t\t->setElTemperature($importedRow['el_temperature'])\n\t\t\t\t\t->setElContinentality($importedRow['el_continentality'])\n\t\t\t\t\t->setElHumidity($importedRow['el_humidity'])\n\t\t\t\t\t->setElPh($importedRow['el_ph'])\n\t\t\t\t\t->setElNutrients($importedRow['el_nutrients'])\n\t\t\t\t\t->setElSalinity($importedRow['el_salinity'])\n\t\t\t\t\t->setKindgom($importedRow['kingdom'])\n\t\t\t\t\t->setBranch($importedRow['branch'])\n\t\t\t\t\t->setSubBranch($importedRow['sub_branch'])\n\t\t\t\t\t->setClass($importedRow['class'])\n\t\t\t\t\t->setSubClass($importedRow['sub_class'])\n\t\t\t\t\t->setIntermediateClade1($importedRow['intermediate_clade_1'])\n\t\t\t\t\t->setIntermediateClade2($importedRow['intermediate_clade_2'])\n\t\t\t\t\t->setIntermediateClade3($importedRow['intermediate_clade_3'])\n\t\t\t\t\t->setSuperOrder($importedRow['super_order'])\n\t\t\t\t\t->setIntermediateClade4($importedRow['intermediate_clade_4'])\n\t\t\t\t\t->setOrder($importedRow['order'])\n\t\t\t\t\t->setSubOrder($importedRow['sub_order'])\n\t\t\t\t\t->setFamily($importedRow['family'])\n\t\t\t\t\t->setSubFamily($importedRow['sub_family'])\n\t\t\t\t\t->setTribe($importedRow['tribe'])\n\t\t\t\t\t->setSubTribe($importedRow['sub_tribe'])\n\t\t\t\t\t->setSection($importedRow['section'])\n\t\t\t\t\t->setSubSection($importedRow['sub_section'])\n\t\t\t\t\t->setSerie($importedRow['serie'])\n\t\t\t\t\t->setPhytobaseId($importedRow['phytobase_id'])\n\t\t\t\t\t->setPhytobaseName($importedRow['phytobase_name'])\n\t\t\t\t;\n\t\t\t\t$em->persist($sp);\n\t\t\t\t$countImports++;\n\n\t\t\t\t// Flush and detach entities each $batchSize time\n\t\t\t\tif (($i % $batchSize) === 0) {\n\t\t\t $em->flush();\n\t\t\t for ($i=($cycle*$batchSize)+$i; $i < $i=($cycle*$batchSize)+$i+$batchSize; $i++) { \n\t\t\t \t$em->detach($entities[($cycle*$batchSize)+$i]);\n\t\t\t }\n\t\t\t $cycle = $cycle+1;\n\t\t\t }\n\t\t\t\t$i = $i+1;\n\n\t\t\t}\n\n\t\t\t// Flush the last entities (the last batch cycle may not be full)\n\t $em->flush();\n\t\t $em->clear();\n\n\t\t\t// Flash and return\n\t $this->get('session')->getFlashBag()->add(\n\t 'success',\n\t $countImports.' données ont été importées (baseflor).'\n\t );\n\n\t return $this->render('evegAppBundle:Admin:importBaseflor.html.twig', array(\n\t\t\t\t'form' => $form->createView()\n\t\t\t));\n\n\t\t}\n\n\t\treturn $this->render('evegAppBundle:Admin:importBaseflor.html.twig', array(\n\t\t\t'form' => $form->createView()\n\t\t));\n\t}", "static public function mdlIngresarEscribano($tabla, $datos){\n\n\t\t$stmt = Conexion::conectarEnlace()->prepare(\"INSERT INTO $tabla(`id`,`nombre`,`documento`,id_tipo_iva,tipo,facturacion,tipo_factura,`cuit`, `direccion`,`localidad`, `telefono`,`email` , `id_categoria`,`id_escribano_relacionado`, `id_osde`,`ultimolibrocomprado`,`ultimolibrodevuelto`,`apellido_ws`,`nombre_ws`,`matricula_ws`) VALUES\n\t\t\t\t\t (:id,:nombre,:documento,:id_tipo_iva,:tipo,:facturacion,:tipo_factura,:cuit,:direccion,:localidad,:telefono,:email,:id_categoria,:id_escribano_relacionado,:id_osde,:ultimolibrocomprado,:ultimolibrodevuelto,:apellido_ws,:nombre_ws,:matricula_ws)\");\n\n\t\t$stmt->bindParam(\":id\", $datos[\"id\"], PDO::PARAM_INT);\n\t\t$stmt->bindParam(\":nombre\", $datos[\"nombre\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":documento\", $datos[\"documento\"], PDO::PARAM_INT);\n\n\t\t$stmt->bindParam(\":id_tipo_iva\", $datos[\"id_tipo_iva\"], PDO::PARAM_INT);\n\t\t$stmt->bindParam(\":tipo\", $datos[\"tipo\"], PDO::PARAM_STR);\n $stmt->bindParam(\":facturacion\", $datos[\"facturacion\"], PDO::PARAM_STR);\n $stmt->bindParam(\":tipo_factura\", $datos[\"tipo_factura\"], PDO::PARAM_STR);\n \n\t\t$stmt->bindParam(\":cuit\", $datos[\"cuit\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":direccion\", $datos[\"direccion\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":localidad\", $datos[\"localidad\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":telefono\", $datos[\"telefono\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":email\", $datos[\"email\"], PDO::PARAM_STR);\n\t\t\n\t\t$stmt->bindParam(\":id_categoria\", $datos[\"id_categoria\"], PDO::PARAM_INT);\n\t\t$stmt->bindParam(\":id_escribano_relacionado\", $datos[\"id_escribano_relacionado\"], PDO::PARAM_INT);\n\t\t$stmt->bindParam(\":id_osde\", $datos[\"id_osde\"], PDO::PARAM_INT);\n\t\t$stmt->bindParam(\":ultimolibrocomprado\", $datos[\"ultimolibrocomprado\"], PDO::PARAM_INT);\n\t\t$stmt->bindParam(\":ultimolibrodevuelto\", $datos[\"ultimolibrodevuelto\"], PDO::PARAM_INT);\n\t\t\n\t\t$stmt->bindParam(\":apellido_ws\", $datos[\"apellido_ws\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":nombre_ws\", $datos[\"nombre_ws\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":matricula_ws\", $datos[\"matricula_ws\"], PDO::PARAM_STR);\n\t\t\t \n\t\tif($stmt->execute()){\n\n\t\t\treturn \"ok\";\n\n\t\t}else{\n\n\t\t\treturn \"error\";\n\t\t\n\t\t}\n\n\t\t$stmt->close();\n\t\t$stmt = null;\n\n\t}", "function evt__form_integrante_e__guardar($datos)\r\n\t{\r\n $pe=$this->dep('datos')->tabla('pextension')->get();\r\n $datos['id_pext']=$pe['id_pext'];\r\n $datos['nro_tabla']=1;\r\n //recupero todas las personas, Las recupero igual que como aparecen en operacion Configuracion->Personas\r\n //$personas=$this->dep('datos')->tabla('persona')->get_listado(); \r\n $datos['tipo_docum']=$datos['integrante'][0];\r\n $datos['nro_docum']=$datos['integrante'][1];\r\n $this->dep('datos')->tabla('integrante_externo_pe')->set($datos);\r\n $this->dep('datos')->tabla('integrante_externo_pe')->sincronizar();\r\n $this->dep('datos')->tabla('integrante_externo_pe')->resetear();\r\n\t}", "static public function mdlIngresarVenta($tabla, $datos){\n\n\t\t$stmt = Conexion::conectar()->prepare(\"INSERT INTO $tabla(fecha,codigo, id_cliente, id_vendedor,detalle, productos,nrofc, impuesto, neto, total,adeuda,observaciones,metodo_pago,fechapago) VALUES (:fecha,:codigo, :id_cliente, :id_vendedor,:detalle, :productos,:nrofc, :impuesto, :neto, :total,:adeuda,:obs, :metodo_pago,:fechapago)\");\n\n\t\t$stmt->bindParam(\":fecha\", $datos[\"fecha\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":codigo\", $datos[\"codigo\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":id_cliente\", $datos[\"id_cliente\"], PDO::PARAM_INT);\n\t\t$stmt->bindParam(\":id_vendedor\", $datos[\"id_vendedor\"], PDO::PARAM_INT);\n\t\t$stmt->bindParam(\":nrofc\", $datos[\"nrofc\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":detalle\", $datos[\"detalle\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":productos\", $datos[\"productos\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":impuesto\", $datos[\"impuesto\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":neto\", $datos[\"neto\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":total\", $datos[\"total\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":adeuda\", $datos[\"adeuda\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":obs\", $datos[\"obs\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":metodo_pago\", $datos[\"metodo_pago\"], PDO::PARAM_STR);\n\t\t$stmt->bindParam(\":fechapago\", $datos[\"fechapago\"], PDO::PARAM_STR);\n\t\t\n\t\tif($stmt->execute()){\n\n\t\t\treturn \"ok\";\n\n\t\t}else{\n\n\t\t\treturn \"error\";\n\t\t\n\t\t}\n\n\t\t$stmt->close();\n\t\t$stmt = null;\n\n\t}" ]
[ "0.7009704", "0.66007316", "0.64541805", "0.63660324", "0.63465595", "0.6230424", "0.61836207", "0.6175527", "0.6122108", "0.61170614", "0.61170083", "0.6111459", "0.608817", "0.6057148", "0.5954295", "0.5950688", "0.5931632", "0.5930221", "0.59226644", "0.5914251", "0.5906465", "0.59047693", "0.5891773", "0.58854157", "0.58763283", "0.584252", "0.5835853", "0.5832938", "0.58312446", "0.5821985" ]
0.75932086
0
Appends $task as a child of current task. It skips current task, skips all task with the same type and appends $task after all its siblings
public function append_child( $task ) { $ind = $this->_get_current_task(); $this_task = $this->_tasks[$ind]; $ind++; while ( isset( $this->_tasks[$ind] ) && ( $this->_tasks[$ind]['type'] == $task['type'] || $this->_tasks[$ind]['type'] == $this_task['type'] ) ) { $ind++; } return $this->append_after( $task, $ind - 1 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addTask( $task ){\n $this->tasks[] = $task; \n }", "public function addTask()\n\t{\n\t\t$this->editTask();\n\t}", "public function appendTask(User $user, Task $task)\n {\n $this->tasks[] = $task;\n }", "public function appendTask(User $user, Task $task);", "public function addTask(\\Torine\\WorkflowBundle\\Model\\Task\\Task $task)\n {\n $this->tasks[] = $task;\n \n return $this;\n }", "function pm_existing_pages_pm_existing_pages_build_subtask($task, $task_id) {\n $info = pm_existing_pages_get_existing_pages($task_id);\n $paths = explode(\"\\n\", $info->paths);\n $main_path = $paths[0];\n $subtask = array(\n 'name' => $task_id,\n 'admin title' => check_plain($info->label),\n 'admin path' => check_plain($main_path),\n 'admin description' => check_plain($info->label),\n 'admin type' => t('Existing'),\n 'row class' => empty($page->disabled) ? 'page-manager-enabled' : 'page-manager-disabled',\n 'storage' => t('In code'),\n 'disabled' => variable_get('pm_existing_pages_disabled_' . $task_id, TRUE),\n 'enable callback' => 'pm_existing_pages_pm_existing_pages_enable',\n );\n\n return $subtask;\n}", "public function addTask(ITask $task) {\r\n\t\t$this->tasks[] = $task;\r\n\t\treturn $this;\r\n\t}", "function pm_existing_pages_pm_existing_pages_build_subtask($task, $task_id) {\n $info = pm_existing_pages_get_existing_pages($task_id);\n $paths = explode(\"\\n\", $info->paths);\n $main_path = $paths[0];\n $subtask = array(\n 'name' => $task_id,\n 'admin title' => check_plain($info->label),\n 'admin path' => check_plain($main_path),\n 'admin description' => check_plain($info->label),\n 'admin type' => t('Existing'),\n 'storage' => t('In code'),\n 'disabled' => variable_get('pm_existing_pages_disabled_' . $task_id, TRUE),\n 'enable callback' => 'pm_existing_pages_pm_existing_pages_enable',\n );\n\n return $subtask;\n}", "public function getChild()\n {\n if (is_null($this->_childTask) || empty($this->_childTask)) {\n try {\n $sql = 'SELECT * FROM tm_task_relation WHERE parent_id=' . $this->_id;\n $result = $this->_db->query($sql, StdLib_DB::QUERY_MOD_ASSOC);\n\n if (isset($result[0]['child_id'])) {\n foreach ($result as $res) {\n $this->_childTask[] = TM_Task_Task::getInstanceById($res['child_id']);\n }\n } else {\n $this->_childTask = array();\n }\n return $this->_childTask;\n } catch (Exception $e) {\n throw new Exception($e->getMessage());\n }\n } else {\n return $this->_childTask;\n }\n }", "public function children()\n {\n return $this->hasMany('App\\Task', 'parent_id');\n }", "public function getSubTasks()\r\n {\r\n return $this->hasMany(self::class, ['id' => 'parent_task_id']);\r\n }", "function taskNewI() {\r\n\t\t\t$this->obj_tasks->addNewItem();\r\n\t\t}", "public function deleteAllParent()\n {\n $this->_parentTask = array();\n }", "protected function saveChild()\n {\n try {\n $sql = 'DELETE FROM tm_task_relation WHERE parent_id=' . $this->_id;\n $this->_db->query($sql);\n\n if (!is_null($this->_childTask) && !empty($this->_childTask)) {\n $sql = 'INSERT INTO tm_task_relation(parent_id, child_id) VALUES';\n\n foreach ($this->_childTask as $child) {\n $sql .= '(' . $this->_id . ', ' . $child->getId() . '), ';\n }\n\n $sql = substr($sql, 0, strlen($sql) - 2);\n $this->_db->query($sql);\n }\n\n } catch (Exception $e) {\n throw new Exception($e->getMessage());\n }\n }", "public function create_end_task()\n {\n $last_entry = $this->lastEntry;\n $end_entry;\n\n //if the last entry type is pause, we set the entry duration to 0\n if ($last_entry->entry_type == 'pause') {\n $end_entry = $this->create_entry(); \n }\n else{\n\n $end_entry = $this->create_entry();\n \n //calculation of interval duration of a task from its previous entry to the paused one\n $end_entry->entry_duration = diffSecond($last_entry->entry_time,$end_entry->entry_time);\n $end_entry->save();\n }\n\n return $end_entry;\n }", "public function add($task): void\n {\n $this->tasks[] = $task;\n }", "public function addTask($task){\n /*return Task::create([\n 'project_id' => $this->id,\n 'description' => $description\n ]);*/\n\n // this is the more streamlined way of doing it\n return $this->tasks()->create($task);\n }", "public function makeLastChildOf($node);", "public function push(Task $task): Task;", "public function sortTasks()\n\t{\n\t\t$next = array();\n\t\t$normal = array();\n\t\t$completed = array();\n\t\tforeach ($this->tasks as $task) {\n\t\t\tif ($task->isComplete()) {\n\t\t\t\t$completed[] = $task;\n\t\t\t}//if ($task->isComplete())\n\t\t\telseif ($task->isNextAction()) {\n\t\t\t\t$next[] = $task;\n\t\t\t}//elseif ($task->isNextAction())\n\t\t\telse{\n\t\t\t\t$normal[] = $task;\n\t\t\t}\n\t\t}//foreach ($this->tasks as $tasks)\n\t\tusort($next, 'static::cmpDescription');\n\t\tusort($normal, 'static::cmpDescription');\n\t\tusort($completed, 'static::cmpCompleted');\n\t\t$this->tasks = array_merge($next, $normal, $completed);\n\t}", "public function handleAddingTask()\n {\n $post = $this->ci->input->post();\n\n $params = isset($post['params']) ? $post['params'] : array();\n\n $params['type'] = $post['type'];\n $params['id'] = $post['id'];\n\n $task = [\n 'name' => $post['name'],\n 'type' => 'POKE',\n 'frequency' => 'ONCE',\n 'priority' => isset($post['priority']) ? $post['priority'] : 1,\n 'params' => http_build_query($params)\n ];\n\n return $this->taskManager->addTask($task);\n }", "public function addTask($data);", "public function getAdditionalFields(array &$taskInfo, $task, \\TYPO3\\CMS\\Scheduler\\Controller\\SchedulerModuleController $parentObject) {\n\n\t\t$this->fieldNamePrefix = 'tx_scheduler[' . $this->extKey . '][' . $this->taskKey . ']';\n\t\t$additionalFields = array();\n\n\t\t$editEntry = false;\n\t\tif ($parentObject->CMD === 'edit') {\n\t\t\t$editEntry = true;\n\t\t}\n\n\t\t// write link field\n\t\tif (empty($taskInfo[$this->extKey][$this->taskKey]['link'])) {\n\t\t\tif ($editEntry) {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['link'] = $task->link;\n\t\t\t} else {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['link'] = '';\n\t\t\t}\n\t\t}\n\t\t$fieldID_0 = 'task_' . $this->taskKey . '_link';\n\t\t$fieldCode_0 = $this->getTextField($fieldID_0, 'link', $taskInfo[$this->extKey][$this->taskKey]['link']);\n\t\t$additionalFields[$fieldID_0] = array(\n\t\t\t'code' => $fieldCode_0,\n\t\t\t'label' => 'LLL:EXT:' . $this->extKey . '/Resources/Private/Language/locallang.xlf:task_f_0'\n\t\t);\n\n\t\t// write rootpage_id field\n\t\tif (empty($taskInfo[$this->extKey][$this->taskKey]['rootpage_id'])) {\n\t\t\tif ($editEntry) {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['rootpage_id'] = $task->rootpage_id;\n\t\t\t} else {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['rootpage_id'] = '';\n\t\t\t}\n\t\t}\n\t\t$fieldID_6 = 'task_' . $this->taskKey . '_rootpage_id';\n\t\t$fieldCode_6 = $this->getTextField($fieldID_6, 'rootpage_id', $taskInfo[$this->extKey][$this->taskKey]['rootpage_id']);\n\t\t$additionalFields[$fieldID_6] = array(\n\t\t\t'code' => $fieldCode_6,\n\t\t\t'label' => 'LLL:EXT:' . $this->extKey . '/Resources/Private/Language/locallang.xlf:task_f_6'\n\t\t);\n\n\t\t// write language field\n\t\tif (empty($taskInfo[$this->extKey][$this->taskKey]['transLanguage'])) {\n\t\t\tif ($editEntry) {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['transLanguage'] = $task->translang;\n\t\t\t} else {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['transLanguage'] = 'en';\n\t\t\t}\n\t\t}\n\t\t$fieldID_1 = 'task_' . $this->taskKey . '_transLanguage';\n\t\t$fieldCode_1 = $this->getTranslationField($fieldID_1, $taskInfo[$this->extKey][$this->taskKey]['transLanguage']);\n\t\t$additionalFields[$fieldID_1] = array(\n\t\t\t'code' => $fieldCode_1,\n\t\t\t'label' => 'LLL:EXT:' . $this->extKey . '/Resources/Private/Language/locallang.xlf:task_f_1'\n\t\t);\n\n\t\t// write receiver email field\n\t\tif (empty($taskInfo[$this->extKey][$this->taskKey]['receiver_email'])) {\n\t\t\tif ($editEntry) {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['receiver_email'] = $task->receiver_email;\n\t\t\t} else {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['receiver_email'] = '';\n\t\t\t}\n\t\t}\n\t\t$fieldID_2 = 'task_' . $this->taskKey . '_receiver_email';\n\t\t$fieldCode_2 = $this->getTextField($fieldID_2, 'receiver_email', $taskInfo[$this->extKey][$this->taskKey]['receiver_email']);\n\t\t$additionalFields[$fieldID_2] = array(\n\t\t\t'code' => $fieldCode_2,\n\t\t\t'label' => 'LLL:EXT:' . $this->extKey . '/Resources/Private/Language/locallang.xlf:task_f_2'\n\t\t);\n\n\t\t// write receiver name field\n\t\tif (empty($taskInfo[$this->extKey][$this->taskKey]['receiver_name'])) {\n\t\t\tif ($editEntry) {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['receiver_name'] = $task->receiver_name;\n\t\t\t} else {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['receiver_name'] = '';\n\t\t\t}\n\t\t}\n\t\t$fieldID_3 = 'task_' . $this->taskKey . '_receiver_name';\n\t\t$fieldCode_3 = $this->getTextField($fieldID_3, 'receiver_name', $taskInfo[$this->extKey][$this->taskKey]['receiver_name']);\n\t\t$additionalFields[$fieldID_3] = array(\n\t\t\t'code' => $fieldCode_3,\n\t\t\t'label' => 'LLL:EXT:' . $this->extKey . '/Resources/Private/Language/locallang.xlf:task_f_3'\n\t\t);\n\n\t\t// write sender email field\n\t\tif (empty($taskInfo[$this->extKey][$this->taskKey]['sender_email'])) {\n\t\t\tif ($editEntry) {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['sender_email'] = $task->sender_email;\n\t\t\t} else {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['sender_email'] = '';\n\t\t\t}\n\t\t}\n\t\t$fieldID_4 = 'task_' . $this->taskKey . '_sender_email';\n\t\t$fieldCode_4 = $this->getTextField($fieldID_4, 'sender_email', $taskInfo[$this->extKey][$this->taskKey]['sender_email']);\n\t\t$additionalFields[$fieldID_4] = array(\n\t\t\t'code' => $fieldCode_4,\n\t\t\t'label' => 'LLL:EXT:' . $this->extKey . '/Resources/Private/Language/locallang.xlf:task_f_4'\n\t\t);\n\n\t\t// write sender name field\n\t\tif (empty($taskInfo[$this->extKey][$this->taskKey]['sender_name'])) {\n\t\t\tif ($editEntry) {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['sender_name'] = $task->sender_name;\n\t\t\t} else {\n\t\t\t\t$taskInfo[$this->extKey][$this->taskKey]['sender_name'] = '';\n\t\t\t}\n\t\t}\n\t\t$fieldID_5 = 'task_' . $this->taskKey . '_sender_name';\n\t\t$fieldCode_5 = $this->getTextField($fieldID_5, 'sender_name', $taskInfo[$this->extKey][$this->taskKey]['sender_name']);\n\t\t$additionalFields[$fieldID_5] = array(\n\t\t\t'code' => $fieldCode_5,\n\t\t\t'label' => 'LLL:EXT:' . $this->extKey . '/Resources/Private/Language/locallang.xlf:task_f_5'\n\t\t);\n\n\t\treturn $additionalFields;\n\t}", "public function addTask(Task $task)\n {\n $this->tasks[$task->getId()] = $task;\n }", "public function taskFinished(BuildEvent $event)\n {\n $taskTimerStart = array_pop($this->timesStack);\n $taskElement = array_pop($this->elementStack);\n\n $elapsedTime = Phing::currentTimeMillis() - $taskTimerStart;\n $taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime));\n\n $parentElement = $this->elementStack[count($this->elementStack) - 1];\n $parentElement->appendChild($taskElement);\n }", "protected function createTask() {\n //TODO: validar datos de la tarea antes de guardarla\n //if ($this->checkTaskData()) { \n $this->db->query(\"INSERT INTO \" . DB_PREFIX . \"task SET \n store_id = '\" . (int) $this->store_id . \"',\n object_id = '\" . (int) $this->object_id . \"',\n object_type = '\" . $this->db->escape($this->object_type) . \"',\n task = '\" . $this->db->escape($this->task) . \"',\n type = '\" . $this->db->escape($this->type) . \"',\n params = '\" . serialize($this->params) . \"',\n time_interval = '\" . $this->db->escape($this->time_interval) . \"',\n time_exec = '\" . $this->db->escape($this->time_exec) . \"',\n time_last_exec = '\" . (int) $this->time_last_exec . \"',\n run_once = '\" . (int) $this->run_once . \"',\n status = '\" . (int) $this->status . \"',\n sort_order = '\" . (int) $this->getTaskSortOrder($this->time_exec) . \"',\n date_start_exec= '\" . $this->db->escape($this->date_start_exec) . \"',\n date_end_exec = '\" . $this->db->escape($this->date_end_exec) . \"'\n \");\n\n $task_id = $this->db->getLastId();\n\n foreach ($this->queue as $key => $queue) {\n if (isset($queue['task_queue_id'])) {\n $this->db->query(\"REPLACE INTO \" . DB_PREFIX . \"task_queue SET \n task_queue_id = '\" . (int) $queue['task_queue_id'] . \"',\n task_id = '\" . (int) $task_id . \"',\n params = '\" . serialize($queue['params']) . \"',\n time_exec = '\" . $this->db->escape($queue['time_exec']) . \"',\n status = '\" . (int) $queue['status'] . \"',\n sort_order = '\" . (int) $key . \"'\n \");\n } else {\n $this->db->query(\"INSERT INTO \" . DB_PREFIX . \"task_queue SET \n task_id = '\" . (int) $task_id . \"',\n params = '\" . serialize($queue['params']) . \"',\n time_exec = '\" . $this->db->escape($queue['time_exec']) . \"',\n status = '\" . (int) $queue['status'] . \"',\n sort_order = '\" . (int) $key . \"'\n \");\n }\n }\n return $task_id;\n //}\n return false;\n }", "public function postCommentsOnTaskAdd(array $taskData): void\n\t{\n\t\t$addComments = $this->prepareCommentsOnTaskAdd($taskData);\n\t\t$this->addComments($addComments);\n\n\t\tif ($this->getDeferredPostMode())\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$this->postComments();\n\t\t$this->clearComments();\n\t}", "public function takeOrder($task) {\n $task->setWorker($this);\n $dao = new TaskDAO;\n $dao->update($task);\n }", "function update_dependency(&$bean, $event, $arguments)\n {\n $Task = BeanFactory::getBean('ProjectTask');\n $tasks = $Task->get_full_list(\"\", \"project_task.project_id = '\" . $bean->project_id . \"' AND project_task.predecessors = '\" . $bean->project_task_id . \"'\");\n\n if ($bean->date_finish != $bean->fetched_row['date_finish']) { //if the end date of a current task is changed\n\n $diff = $this->count_days($bean->date_finish, $bean->fetched_row['date_finish']); //Gets the difference in days\n\n foreach ($tasks as $task) { //loop through all dependant tasks\n\n $rel_type = $task->relationship_type; //Determine their dependency type\n\n if ($rel_type == 'FS') { //if its a Finish to start\n //Modify the task's start and end date dependant on the difference in days\n $start = new DateTime($task->date_start);\n $start = $start->modify($diff);\n $startdate = $start->format('Y-m-d');\n\n $duration = $task->duration - 1; //take one off to maintain correct gantt bar length\n\n $enddate = $start->modify('+' . $duration . ' days');\n $enddate = $enddate->format('Y-m-d');\n\n $task->date_start = $startdate;\n $task->date_finish = $enddate;\n $task->save();\n\n } else if ($rel_type == 'SS') { //if its a start to start\n //check if the tasks duration has not been changed so that it does not update when the parent tasks duration is changed\n if ($bean->fetched_row['duration'] == $bean->duration) {\n\n $start = new DateTime($task->date_start);\n $start = $start->modify($diff);\n $startdate = $start->format('Y-m-d');\n\n $duration = $task->duration - 1;\n\n $enddate = $start->modify('+' . $duration . ' days');\n $enddate = $enddate->format('Y-m-d');\n\n $task->date_start = $startdate;\n $task->date_finish = $enddate;\n $task->save();\n\n }\n\n }\n\n }\n\n }\n }", "static function generateRecursiveTaskList($uid, $tasks)\n {\n $htm = '';\n if (!empty($tasks)) {\n $htm = '<ul>';\n foreach ($tasks as $t) {\n $hasSubtask = self::checkSubtask($uid, $t['id']);\n $points = self::calculateTaskPoint($uid, $t['id']);\n $listStyle = '';\n if ($hasSubtask) {\n $listStyle = 'list-style-type:none;';\n }\n $htm .= '<li>' . $t['title'] . '(' . $points . ')</li>';\n if (!empty($t['sub_task'])) {\n $htm .= '<li style=\"' . $listStyle . '\">' . self::generateRecursiveTaskList($uid, $t['sub_task']) . '</li>';\n }\n }\n $htm .= '</ul>';\n }\n return $htm;\n }" ]
[ "0.5556765", "0.54127777", "0.53192466", "0.5308863", "0.51971275", "0.51371485", "0.51171833", "0.49970287", "0.49954015", "0.49851376", "0.49405992", "0.49115178", "0.49074206", "0.4877608", "0.48602787", "0.4851971", "0.48241243", "0.481852", "0.4818285", "0.478464", "0.47392333", "0.47091734", "0.46953112", "0.4678377", "0.4667754", "0.46499392", "0.4630811", "0.4630453", "0.4626422", "0.4614887" ]
0.792866
0
Create field value. The value is processed and stored in passed DOMelement.
protected function buildFieldValue( \DOMElement $result, FieldDescription $fieldInfo, $fieldValue ) { if ( ( $fieldValue instanceof \DOMNode ) || ( $fieldValue instanceof \DOMElement ) ) { try { $result->appendChild( $fieldValue ); } catch ( \Exception $e ) { $result->appendChild( $this->document->importNode( $fieldValue, true ) ); } } elseif ( $fieldInfo->getType() == FieldDescription::FIELD_TYPE_TEXTBOX_LIST ) { if ( $fieldValue = $this->createTextBoxItems( $fieldValue ) ) { try { $result->appendChild( $fieldValue ); } catch ( \Exception $e ) { $result->appendChild( $this->document->importNode( $fieldValue, true ) ); } } } elseif ( ( $fieldInfo->getType() == FieldDescription::FIELD_TYPE_MEDIA ) && $fieldValue ) { try { $result->nodeValue = $fieldValue; if ( $info = E()->FileRepoInfo->analyze( $fieldValue ) ) { $result->setAttribute( 'media_type', $info->type ); $result->setAttribute( 'mime', $info->mime ); } } catch ( SystemException $e ) { } } elseif ( $fieldValue !== false ) { // empty() не пропускает значиния 0 и '0' if ( ! empty( $fieldValue ) || ( $fieldValue === 0 ) || ( $fieldValue === '0' ) ) { switch ( $fieldInfo->getType() ) { case FieldDescription::FIELD_TYPE_STRING: $fieldValue = E()->Utils->formatDate( $fieldValue, $fieldInfo->getPropertyValue( 'outputFormat' ), $fieldInfo->getType() ); break; case FieldDescription::FIELD_TYPE_DATETIME: case FieldDescription::FIELD_TYPE_DATE: case FieldDescription::FIELD_TYPE_TIME: $result->setAttribute( 'date', $fieldValue ); $fieldValue = E()->Utils->formatDate( $fieldValue, $fieldInfo->getPropertyValue( 'outputFormat' ), $fieldInfo->getType() ); break; case FieldDescription::FIELD_TYPE_STRING: case FieldDescription::FIELD_TYPE_TEXT: case FieldDescription::FIELD_TYPE_HTML_BLOCK: //$fieldValue = str_replace('&', '&amp;', $fieldValue); break; default: // not used } $result->appendChild( new \DomText( $fieldValue ) ); } } return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getNode() {\n $node= parent::getNode();\n if (isset($this->value)) {\n $node->setAttribute('val', $this->value);\n } else {\n $node->setAttribute('val', 0); // default\n }\n return $node;\n }", "protected function dateFieldValue() {\n\t\t$value = Object::create('Date');\n\t\t$value->setValue($this->owner->Value);\n\n\t\treturn $value;\n\t}", "private function setFieldValue() {\n $fieldValue = null;\n $field = $this->field;\n $isArray = is_array($field) || Connect::isArray($field);\n $defaults = $this->getDefaultValues($this->data['attrs']['name']);\n\n // Custom attributes and custom fields can have default values specified for them.\n // So if there's a default value for the field but there's also a dynamic default value\n // coming in, that dynamic value should take precedence.\n if (!$isArray && $defaults['meta'] !== '' && $defaults['dynamic'] && !is_null($field) && (string) $field === (string) $defaults['meta']) {\n $this->field = $field = null;\n }\n\n if ($this->dataType === 'Menu') {\n // fieldValue is preserved as the actual Connect menu option object\n $fieldValue = $this->getMenuFieldValue($field, $defaults);\n }\n // If the field has a value (including '') sent in through POST, we should use that.\n // Generally only the case in the basic pageset.\n else if ($defaults['post'] !== false) {\n $fieldValue = $defaults['post'];\n }\n // Check if the field has an existing value.\n else if($field !== null && !$isArray) {\n if (is_bool($field) || is_int($field)) {\n $fieldValue = $field;\n }\n else if (is_string($field)) {\n $fieldValue = htmlspecialchars($field, ENT_QUOTES, 'UTF-8', false);\n }\n }\n // If the field has a value from the URL or widget attributes\n else if($defaults['dynamic']) {\n $fieldValue = $defaults[$defaults['dynamic']];\n }\n else if ($isArray) {\n //Keep an existing array value as an array. It isn't up to this base class to determine what to do\n //with the data so it shouldn't be destroying data. The child widget is responsible for displaying the data to how it sees fit.\n $fieldValue = $field;\n }\n else {\n // Entity-ize any characters in the existing value in non-array types.\n $fieldValue = htmlspecialchars($field, ENT_QUOTES, 'UTF-8', false);\n }\n return $this->modifyDateValue($fieldValue);\n }", "protected function createField($name, $value) {\r\n\t\tif($this->blockTag == 'none' && $this->labelPos == 'none') {\r\n\t\t\t$this->fieldNode = $this;\r\n\t\t} else {\r\n\t\t\t$node = new Larc_Html_Element($this->fieldTag);\r\n\t\t\t$this->fieldNode = $this->appendChild($node);\r\n\t\t}\r\n\r\n\t\t$this->fieldNode->setAttribute(\"name\", $name);\r\n\t\t$this->fieldNode->setAttribute(\"id\", $name);\r\n\t\tif($value !== NULL) {\r\n\t\t\t$this->fieldNode->setAttribute(\"value\", $value);\r\n\t\t}\r\n\r\n\t\tif(isset($this->params['attributes'])) {\r\n\t\t\t$this->initAttributes($this->fieldNode, $this->params['attributes']);\r\n\t\t}\r\n\t\tif(isset($this->params['fieldAttributes'])) {\r\n\t\t\t$this->initAttributes($this->fieldNode, $this->params['fieldAttributes']);\r\n\t\t}\r\n\r\n\t\t$this->fieldNode->setAttribute(\"type\", \"text\");\r\n\t}", "public function createFlexibleValue()\n {\n $class = $this->getFlexibleValueName();\n $value = new $class();\n // dispatch event\n $event = new FilterFlexibleValueEvent($this, $value);\n $this->eventDispatcher->dispatch(FlexibleEntityEvents::CREATE_VALUE, $event);\n\n return $value;\n }", "protected function createField($name, $value) {\r\n\t\tif(isset($this->params['valueFormat'])) {\r\n\t\t\t$this->valueFormat = $this->params['valueFormat'];\r\n\t\t}\r\n\t\tif(isset($this->params['keyFormat'])) {\r\n\t\t\t$this->keyFormat = $this->params['keyFormat'];\r\n\t\t}\r\n\t\t$options = Larc_Date::getAmPm($this->valueFormat, $this->keyFormat);\r\n\t\t\r\n\t\t//$this->fieldNode = new Larc_Html_Element_Select($name, $options, $this);\r\n\t\t$this->fieldNode = new Larc_Html_Element_Select($options, array('name' => $name), $this);\r\n\t\t\t\r\n\t\tif(isset($this->params['attributes'])) {\r\n\t\t\t$this->initAttributes($this->fieldNode, $this->params['attributes']);\r\n\t\t}\r\n\t\tif(isset($this->params['fieldAttributes'])) {\r\n\t\t\t$this->initAttributes($this->fieldNode, $this->params['fieldAttributes']);\r\n\t\t}\r\n\t\t\r\n \tif(!$value) {\r\n \t\t$value = 'now';\r\n\t\t}\r\n\t\t$value = date($this->keyFormat, strtotime('now'));\r\n\t\t\r\n\t\t$this->fieldNode->selectOptionWithValue($value);\r\n\t}", "function createDateTimeElement()\n {\n $element_result = \"\";\n\n if ($this -> how_to_create == \"ViewOnlyElement\")\n {\n // If there is a replace value prog, make sure not to apply format, as the programmer will do so himself\n $replace_value_prog = checkTagContent($this -> form_element_root, $this -> element_root, \"replace_value_prog\");\n if (! is_null($replace_value_prog))\n $element_result = $this -> checkShowInsteadOfValues($this -> cur_value);\n else\n $element_result = applyFormat($this -> cur_value, \"DATE_TIME\", $this -> form_element_root, $this -> element_root);\n }\n elseif ($this -> how_to_create == \"EditElement\"\n || $this -> how_to_create == \"NewElement\")\n {\n // For date/time type of elements, show three components: date part, hour part, minute part\n $date_part_name = $this -> element_name . \"_date\";\n $hour_part_name = $this -> element_name . \"_hour\";\n $minute_part_name = $this -> element_name . \"_min\";\n\n // Also find the value for each date, hour and minute part\n $date_part_val = substr($this -> cur_value, 0, 10);\n $hour_part_val = substr($this -> cur_value, 11, 2);\n //debug($hour_part_val,\"hour_part_val\",\"File: \" . __FILE__ . \" Line: \" . __LINE__) ;\n $minute_part_val = substr($this -> cur_value, 14, 2);\n //debug($minute_part_val,\"minute_part_val\",\"File: \" . __FILE__ . \" Line: \" . __LINE__) ;\n\n $tool_tip = checkTagContent($this -> form_element_root, $this -> element_root, \"tooltip\");\n\n // ****** First create date part with jquery date picker\n $element_result = \"<input name=\\\"\" . $date_part_name . \"\\\" id=\\\"\" . $date_part_name . \"\\\"\";\n $element_result .= \" size=\\\"10\\\" maxlength=\\\"\" . DATE_STR_LEN . \"\\\"\";\n if (! empty($date_part_val))\n $element_result .= \" value=\\\"\" . $date_part_val . \"\\\"\";\n $element_result .= \" title=\\\"\" . processFetched($tool_tip) . \"\\\"\";\n if ($this -> read_only == \"Yes\")\n $element_result .= \" readonly=\\\"yes\\\"\";\n $element_result .= \" type=\\\"text\\\" \" . $this -> display_attributes . \" />\";\n\n // See if we have to start from specific hour or not\n $start_hour = checkTagContent($this -> form_element_root, $this -> element_root, \"start_hour\") ;\n if (is_null($start_hour))\n $start_hour = 0 ;\n \n // See if we have to start from specific hour or not\n $end_hour = checkTagContent($this -> form_element_root, $this -> element_root, \"end_hour\") ;\n if (is_null($end_hour))\n $end_hour = 23 ;\n \n // See if we have to use am/pm format for the hour or \n // military 0 to 23. By default it is military\n $use_am_pm_timing = false ; \n if(checkTagContent($this -> form_element_root,$this -> element_root,\"use_am_pm_timing\") == \"Yes\")\n $use_am_pm_timing = true ;\n \n //****** Create the hour part\n $hour_part = \"\\n<select name=\\\"\" . $hour_part_name . \"\\\" id=\\\"\" . $hour_part_name . \"\\\"\"\n . $this -> display_attributes . \">\";\n for ($i = $start_hour ; $i <= $end_hour ; $i++)\n {\n if ($use_am_pm_timing)\n { \n // Convert display to to am/pm \n if ($i == 0)\n $show_text = \"12 AM\" ;\n elseif ($i < 12)\n $show_text = $i . \" AM\" ;\n elseif ($i == 12)\n $show_text = $i . \" PM\" ;\n else\n $show_text = ($i - 12) . \" PM\" ;\n } \n else // If military timing, then put 0 before\n {\n if ($i < 10)\n $show_text = \"0\" . $i;\n else\n $show_text = $i;\n }\n \n $hour_part .= \"<option value=\\\"\" . ($i < 10 ? \"0\" . $i : $i) . \"\\\"\";\n if ($i == $hour_part_val)\n $hour_part .= \" selected=\\\"selected\\\"\";\n $hour_part .= \">\" . $show_text . \"</option>\";\n }\n $hour_part .= \"\\n</select>\";\n\n //****** Create the minute part\n \n // Because we allow minutes by 5, then round the minutes part to the nearest 5 like\n // 0, 5, 10...\n $min_val_remainder = $minute_part_val % 5 ;\n $minute_part_val -= $min_val_remainder ;\n if ($min_val_remainder >= 2.5)\n $minute_part_val += 5 ;\n \n \n $minute_interval = checkTagContent($this -> form_element_root,$this -> element_root,\"minute_interval\") ;\n if (is_null($minute_interval))\n $minute_interval = 5 ;\n \n $minute_part = \"\\n<select name=\\\"\" . $minute_part_name . \"\\\" id=\\\"\" . $minute_part_name . \"\\\"\"\n . $this -> display_attributes . \">\" ;\n for ($i = 0; $i < 60; $i += $minute_interval)\n {\n if ($i > 9)\n $show_text = $i;\n else\n $show_text = \"0\" . $i;\n $minute_part .= \"<option value=\\\"\" . $show_text . \"\\\"\";\n if ($i == $minute_part_val)\n $minute_part .= \" selected=\\\"selected\\\"\";\n $minute_part .= \">\" . $show_text . \"</option>\";\n }\n $minute_part .= \"\\n</select>\";\n\n $element_result .= $hour_part . \" :\" . $minute_part;\n\n // path to the image that shows the icon where user can click to open the date pop-up\n $jquery_ui_image_path = plugin_folder . \"/jquery_ui/images\";\n if (defined(\"base_folder\"))\n $jquery_ui_image_path = base_folder . \"/\" . $jquery_ui_image_path;\n\n // Add the jquery date picker for the input.\n // Note: We have to keep this code here and not share it, in case we want to have different options per date\n // control\n $element_result .= \"<script type=\\\"text/javascript\\\">\"\n . \"$(function()\"\n . \"{\"\n . \" $(\\\"#\" . $date_part_name . \"\\\").datepicker(\"\n . \"{\"\n . \" showOn: 'button'\"\n . \" , buttonImage: '/\" . $jquery_ui_image_path . \"/calendar.gif'\"\n . \" , buttonImageOnly: true\"\n . \" , dateFormat: 'yy-mm-dd'\"\n . \" , changeMonth: true\"\n . \" , changeYear: true\"\n . \"}\"\n . \") ;\"\n . \"}) ;\"\n . \"</script>\";\n }\n elseif ($this -> how_to_create == \"HiddenElement\")\n {\n $element_result = \"<input name=\\\"\" . $this -> element_name . \"\\\" id=\\\"\" . $this -> element_name . \"\\\"\";\n $element_result .= \" size=\\\"\" . DT_STR_LEN_SHORT . \"\\\" maxlength=\\\"\" . DT_STR_LEN_SHORT . \"\\\"\";\n if (!empty($this -> cur_value))\n $element_result .= \" value=\\\"\" . substr(processFetched($cur_value), 0, DT_STR_LEN_SHORT) . \"\\\"\";\n $element_result .= \" type=\\\"hidden\\\">\";\n }\n\n return $element_result;\n }", "public static function xml_value( $value, $field ) {\n\t\tif ( $field->type === 'signature' ) {\n\t\t\t$value = self::get_final_signature_value( $value, array( 'use_html' => false ) );\n\t\t}\n\n\t\treturn $value;\n\t}", "function _insert_xml_element($schema, $tag, $value, $xml_element){\n // Apply process function\n if(isset($schema['#process'])){\n $f = $schema['#process'];\n if(!function_exists($f)){throw new Exception(\"Process function $f for tag $tag does not exist\");}\n $args = array(\n $value\n );\n if(!empty($schema['#process arguments'])){\n $args = array_merge($args, $schema['#process arguments']);\n }\n $value = call_user_func_array($f, $args);\n }\n // Check for standard drupal field value format. Anything that is a direct value, or\n // an array definined 'value' will need a 'process' function defined.\n if(is_array($value) && isset($value['value'])){\n $value = $value['value'];\n }\n // Create the xml element\n $child_element = $xml_element->appendChild($this->_dom->createElement($tag));\n // Add attributes\n if(!empty($schema['#attributes'])){\n foreach($schema['#attributes'] as $attr_name => $attr_value){\n if(is_callable($attr_value)){\n $attr_value = $attr_value($this->_get_context());\n }\n $child_element->setAttribute($attr_name, $attr_value);\n }\n }\n // Add value\n foreach($this->modifiers as $modifier){\n $value = $modifier->insert_value($tag, $schema, $value);\n }\n if($value !== NULL){\n $fragment = $this->_dom->createDocumentFragment();\n $final_value = $value;\n // Escape the value if needed\n if(empty($schema['#raw'])){\n $final_value = htmlspecialchars($final_value);\n }else{\n $final_value = '<div>' . $final_value . '</div>';\n }\n // Ensure entities are numerical\n $final_value = _publication_xml_translate_entities($final_value);\n $fragment->appendXML($final_value);\n $child_element->appendChild($fragment);\n }\n return $child_element;\n }", "function create_field($field)\n\t{\n\t\t\n\t}", "function create_field( $field ) {\n\n\tacf_render_field( $field );\n\n}", "function dateHtmlGen($field_data, $current_value=NULL)\n\t{\n\t\t$_ret = '';\n\t\t\t\n //$CI =& get_instance();\n\t\t$_ret = '<input class=\"text\" type=\"text\" id=\"'.$field_data['table'].'_'.$field_data['column'].'\" name=\"'.$field_data['table'].'_'.$field_data['column'].'\" value=\"'.$current_value.'\" />';\n\t\t\n\t\treturn $_ret;\n\t\t\n\t}", "public function getFieldValue()\n {\n return $this->field_value;\n }", "public function create()\n\t{\n\t\t$form = $this->initForm(true);\n\t\tif ($form->checkInput())\n\t\t{\n\t\t\t$properties = array(\n\t\t\t\t\"value_1\" => $form->getInput(\"val1\")//,\n\t\t\t\t//\"value_2\" => $form->getInput(\"val2\")\n\t\t\t);\n\t\t\tif ($this->createElement($properties))\n\t\t\t{\n\t\t\t\tilUtil::sendSuccess($this->lng->txt(\"msg_obj_modified\"), true);\n\t\t\t\t$this->returnToParent();\n\t\t\t}\n\t\t}\n\n\t\t$form->setValuesByPost();\n\t\t$this->tpl->setContent($form->getHtml());\n\n\t}", "public function field()\r\n\t{\r\n\t\t$name\t= $this->name;\r\n\t\t$value\t= $this->value;\r\n\t\t$args\t=\tarray_to_string( $this->attributes );\r\n\t\t\r\n\t\t$class\t=\tstr_replace('[', '', str_replace(']', '', $name ) );\r\n\t\t\r\n\t\t$field\t=\t'<input type=\"hidden\" name=\"' . $name . '\" value=\"0\" />'\r\n\t\t\t\t.\t'<div class=\"switch\" data-on=\"primary\" data-off=\"danger\" data-on-label=\"' . t( $this->labelon ) . '\" data-off-label=\"' . t( $this->labeloff ). '\">'\r\n\t\t\t\t.\t'\t<input value=\"1\" name=\"' . $name . '\" type=\"checkbox\" ' . ( $value == 1 ? ' checked=\"checked\"' : '' ) . ' />'\r\n\t\t\t\t.\t'</div>';\r\n\t\t\r\n\t\treturn $field;\r\n\t}", "private function DOMAttribute( $name, $value ) \n { \n //Create the attribute then assign the value \n $attribute = $this->DOMDocument->createAttribute( $name ); \n $attribute->value = $value; \n\n return( $attribute ); \n }", "function getDate ( $field )\n\t{\n\t\t$elementName = 'tx_newseventregister_modfunc1_' . $field;\n\t\t$string\t\t\t\t\t= '<input type=\"text\" name=\"' . $elementName . '\"'\n\t\t\t. ' value = \"' . $this->getPreviousValue($elementName) . '\" '\n\t\t\t. ' size=\"' . $this->inputSize . '\" />';\n\n\t\treturn $string;\n\t}", "protected function __get_value()\n\t{\n\t\treturn $this->element->nodeValue;\n\t}", "private function setFieldValues ()\n {\n $id = $this->createElement('hidden', 'id');\n $id->setAllowEmpty(false);\n $id->setValue($this->_questionData->getId());\n $this->addElement($id);\n $this->categoryType->setValue(\n $this->_questionData->getCategory()\n ->getId());\n $this->marks->setValue($this->_questionData->getMarks());\n $this->question->setValue($this->_questionData->getQuestion());\n $this->questionType->setValue(\n $this->_questionData->getQuestionType()\n ->getId());\n switch ($this->_questionData->getQuestionType()->getId()) {\n case '1':\n $this->checkBox->setValue(\n unserialize($this->_questionData->getAnswers()));\n $this->radio->setRequired(FALSE);\n break;\n case '2':\n $this->radio->setValue(\n unserialize($this->_questionData->getAnswers()));\n $this->checkBox->setRequired(FALSE);\n break;\n case '3':\n $this->freeTextArea->setValue(\n unserialize($this->_questionData->getAnswers()));\n break;\n case '4':\n $this->freeTextBox->setValue(\n unserialize($this->_questionData->getAnswers()));\n break;\n }\n }", "function get_field_value($force = false) {\n\n if (!$this->get_container()->get_extra_fs_values_collection()) return false;\n\n /*\n clone-error-fix test:\n var_dump($this->get_container()->get_parent()->get_id());\n */\n\n if (!isset($this->_field_value) || $force) {\n /*\n $p = $this->get_container()->get_parent();\n $p->get_id();\n $this->_field_value =\n $this->container->get_module()->get_value_handle()\n ->set_limit(1)\n ->set_where('fid = %d AND pid = %d', $this->id, $p->id)\n ->load()\n ->get_item();\n */\n $this->_field_value =\n $this->get_container()\n ->get_extra_fs_values_collection()\n ->get_item_by_prop('fid', $this->id);\n\n core::dprint(array('try fid: %d : %s', $this->id, $this->_field_value ? '+' : '-'));\n\n /** FORMATTED VALUE */\n $this->fvalue =\n $this->efs_format_load($this->_field_value ? $this->efs_format_unserialize($this->_field_value->value) : null);\n\n // core::var_dump($this->fvalue);\n }\n\n return $this->_field_value;\n }", "public function generate()\n {\n $amount = $this->currencyPosition == 'right' ? $this->amount . ' ' . $this->currency : $this->currency . ' ' . $this->amount;\n return sprintf('<input type=\"hidden\" name=\"%s\" value=\"%s\"%s<div class=\"sessionformfield%s\"><span>%s</span></div>',\n $this->strName,\n specialchars($this->varValue),\n $this->strTagEnding,\n $this->class == \"\" ? \"\" : \" \" . $this->class,\n $amount);\n }", "protected function addField()\n\t{\n\t\t$this->initFieldForm(self::MODE_CREATE);\n\t\t\n\t\t$this->form->getItemByPostVar('va')->setValues(array(''));\n\t\t\n\t\t$this->tpl->setContent($this->form->getHTML());\n\t}", "public function addValue()\n {\n $this->addElement($this->getTextareaElement('value', 'Value', false));\n }", "protected function _Get_Field_Value($field_instance) {\r\n do_action('vcff_pre_field_value', $field_instance);\r\n // If this field has a custom validation method\r\n if (method_exists($field_instance,'Pre_Value')) { $field_instance->Pre_Value(); }\r\n // Populate with any posted values\r\n $this->_Get_Posted_Field_Value($field_instance);\r\n // Populate with any dynamic values\r\n $this->_Get_Dynamic_Field_Value($field_instance);\r\n // Populate with any default value\r\n $this->_Get_Default_Field_Value($field_instance);\r\n // Do any create actions\r\n $field_instance->Do_Action('populate_value');\r\n // Retrieve the validation result\r\n do_action('vcff_post_field_value', $field_instance);\r\n // If this field has a custom validation method\r\n if (method_exists($field_instance,'Post_Value')) { $field_instance->Post_Value(); }\r\n }", "public function getFieldValue($field);", "function get_value($post_id, $field)\n\t{\n\t\t// get value\n\t\t$value = parent::get_value($post_id, $field);\n\t\t\n\t\t// format value\n\t\t\n\t\t// return value\n\t\treturn $value;\t\t\n\t}", "public function value($field);", "static function PrepareFieldValue($type, $value, $flag=null, &$object, $field){\n switch ($type) {\n case \"date\":\n $value = Component::dateconv($value, (bool)$flag);\n\n break;\n case \"spaweditor\":\n if(PublicationHelper::HasPaging($value)){\n $value = PublicationHelper::GetSelectedPage($value, $field, $object);\n PublicationHelper::AddArticlePaging($object, $field);\n }\n break;\n default:\n break;\n }\n return $value;\n }", "public function getFieldValue() : string;", "public function getFieldValue(): string;" ]
[ "0.62018675", "0.612046", "0.6076827", "0.60417134", "0.5818637", "0.5750038", "0.56449836", "0.5625722", "0.5568773", "0.5555405", "0.5478125", "0.54774964", "0.54661554", "0.54324275", "0.54037106", "0.53088915", "0.529755", "0.5280008", "0.52726364", "0.5262189", "0.5257396", "0.52477044", "0.5242627", "0.51879096", "0.5176693", "0.5174463", "0.5158936", "0.5153597", "0.5138178", "0.5136771" ]
0.66898197
0
Return the http instance.
public function getHttp() { if (is_null($this->http)) { $this->http = new Http(); } return $this->http; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getHttp()\n {\n if (is_null($this->_http)) {\n $this->_http = new Http();\n }\n return $this->_http;\n }", "protected function http()\n {\n if(!$this->client)\n $this->client = new Client($this->getHttpSettings());\n\n return $this->client;\n }", "protected function http()\n {\n return new Client;\n }", "protected static function instanceHttpClient(): ImBot\\Http\n\t{\n\t\tif (!(self::$httpClient instanceof ImBot\\Http))\n\t\t{\n\t\t\tself::$httpClient = new ImBot\\Http(self::BOT_CODE);\n\t\t}\n\n\t\treturn self::$httpClient;\n\t}", "public function http()\n {\n return $this->client;\n }", "function getInstance() {\n\t\tglobal $instanceSimpleHTTP;\n\t\t// initialize if needed\n\t\tif (!isset($instanceSimpleHTTP))\n\t\t\tSimpleHTTP::initialize();\n\t\treturn $instanceSimpleHTTP;\n\t}", "protected function httpClient()\n {\n return new HttpClient();\n }", "protected function httpClient()\n {\n return $this->http ?: $this->http = new Client();\n }", "public function http(){\n return $this->http;\n }", "public function getHttpClient()\n {\n return $this->_http;\n }", "protected function createHttpClient()\n {\n return $this->setHttpClient(new HttpClient());\n }", "public function getHTTP()\n {\n return $this->HTTP;\n }", "public function get() {\n return new $this->instance_name(\n $this->client, $this->uri\n );\n }", "public function get_http_strategy(): Http_Strategy\n {\n return $this->http_strategy;\n }", "public static function factory()\n\t{\n\t\t$o = new HttpRequest();\n\t\t$o->getRequestUri();\n\t\treturn $o;\n\t}", "static function init()\n {\n if(isset(HttpResp::$self))\n return HttpResp::$self;\n\n return new HttpResp();\n }", "public function buildHttpFactory(): HttpFactory\n {\n return $this->httpFactory = $this->httpFactory ?? new HttpFactory();\n }", "public function getHttpClient(): HttpClient\n {\n return $this->httpClient;\n }", "public function singleton() {\n\t\t// check it the HTTPRequest is already initialized\n\t\tif(self::$INSTANCE == null) { // if not, initialize it\n\t\t\tself::$INSTANCE = new TechDivision_Controller_Mock_Request();\n\t\t}\n\t\t// return the actual HTTPRequest instance\n\t\treturn self::$INSTANCE;\n }", "public static function getHttpClient()\n {\n return self::$_httpClient;\n }", "protected function getHttpClient()\n {\n $client = new HttpClient([\n 'base_url' => [$this->getBaseUrl(), ['version' => $this->getVersion()]],\n 'defaults' => [\n 'headers' => [\n 'User-Agent' => 'Ipalaus-Wistia/' . self::VERSION\n ],\n 'auth' => ['api', $this->getToken()]\n ],\n ]);\n\n return $client;\n }", "public function getHttpClient(): HttpClient;", "protected function getHttpClient()\n {\n return $this->httpClient;\n }", "public function getHttpClient();", "public function getHttpClient();", "public function getHttpClient();", "public function getHttpClient()\n {\n return $this->_httpClient;\n }", "public function getHttpClient()\n {\n return $this->httpClient;\n }", "public function getHttpClient()\n {\n return $this->httpClient;\n }", "public function getHttpClient()\n {\n return $this->httpClient;\n }" ]
[ "0.8575551", "0.7975396", "0.78918105", "0.7715141", "0.7639517", "0.7514558", "0.7354907", "0.73480403", "0.73202825", "0.72489667", "0.7054371", "0.6909928", "0.68825", "0.68485874", "0.67108715", "0.66836864", "0.6649032", "0.6638084", "0.6635266", "0.6620159", "0.6588245", "0.6584947", "0.65845096", "0.65431434", "0.65431434", "0.65431434", "0.653119", "0.65003765", "0.65003765", "0.65003765" ]
0.84508115
1
Set the http instance.
public function setHttp(Http $http) { $this->http = $http; return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setHttp(?string $http): void\n {\n $this->http = $http;\n }", "public function getHttp()\n {\n if (is_null($this->_http)) {\n $this->_http = new Http();\n }\n return $this->_http;\n }", "public function __construct()\n {\n parent::__construct();\n\n $this->http = new HttpClient();\n }", "public function set($instance);", "public function set() {\n\n\t\tself::$instance = $this;\n\t\t$this->base \t= OMAPI::get_instance();\n\t\t$this->view = isset( $_GET['optin_monster_api_view'] ) ? stripslashes( $_GET['optin_monster_api_view'] ) : $this->base->get_view();\n\t\t$this->optin = isset( $_GET['optin_monster_api_id'] ) ? $this->base->get_optin( absint( $_GET['optin_monster_api_id'] ) ) : false;\n\n\t}", "public function __construct()\n {\n $this->httpClient = new HttpClient();\n }", "public function getHttp()\n\t{\n\t\tif (is_null($this->http)) {\n\t\t\t$this->http = new Http();\n\t\t}\n\n\t\treturn $this->http;\n\t}", "public function setHttp(Client $client);", "public function __construct(HttpClient $http)\n {\n $this->http = $http;\n }", "public function __construct(HttpClient $http)\n {\n $this->http = $http;\n }", "public function __construct(HttpClient $http)\n {\n $this->http = $http;\n }", "public function __construct(Client $http)\n {\n parent::__construct();\n $this->http = $http;\n }", "protected static function instanceHttpClient(): ImBot\\Http\n\t{\n\t\tif (!(self::$httpClient instanceof ImBot\\Http))\n\t\t{\n\t\t\tself::$httpClient = new ImBot\\Http(self::BOT_CODE);\n\t\t}\n\n\t\treturn self::$httpClient;\n\t}", "protected function http()\n {\n if(!$this->client)\n $this->client = new Client($this->getHttpSettings());\n\n return $this->client;\n }", "public function __construct()\n {\n $this->client = new HttpClient();\n }", "public function __construct()\n {\n $this->client = new HttpClient();\n }", "protected function http()\n {\n return new Client;\n }", "public function set_http_strategy(Http_Strategy $http_strategy): static\n {\n $this->http_strategy = $http_strategy;\n\n return $this;\n }", "public function __construct()\n {\n $this->_httpClient = new Varien_Http_Client();\n }", "public function http(){\n return $this->http;\n }", "public function registerHttpConsumer(\\SimpleLifestream\\HttpRequest $http)\n {\n $this->http = $http;\n }", "public static function initHttpTarget($str_http_target) {\n self::$str_http_target = $str_http_target;\n }", "public function __construct()\n {\n $this->httpClient = new Client();\n }", "public function setDriver(HttpDriver $driver)\n {\n $this->driver = $driver;\n }", "function getInstance() {\n\t\tglobal $instanceSimpleHTTP;\n\t\t// initialize if needed\n\t\tif (!isset($instanceSimpleHTTP))\n\t\t\tSimpleHTTP::initialize();\n\t\treturn $instanceSimpleHTTP;\n\t}", "public function http()\n {\n return $this->client;\n }", "public function setInstanceUrl($url);", "public function __construct() \n {\n $this->httpClient = new Client([\n 'base_url' => $this->baseUrl\n ]);\n }", "function __construct()\n {\n $this->_handler = curl_multi_init();\n }", "public function __construct()\n {\n parent::__construct();\n $this->http = Http::baseUrl('https://api.maino.com.br/api/v2/')\n ->contentType('application/json')\n ->withHeaders([\n 'X-Api-Key' => env('MAINO_KEY')\n ]);\n }" ]
[ "0.6818235", "0.63632876", "0.6333846", "0.6330907", "0.6205282", "0.6200686", "0.61995715", "0.6125114", "0.6102615", "0.6102615", "0.6102615", "0.5998282", "0.5974101", "0.5949697", "0.5936069", "0.5936069", "0.5854288", "0.5851493", "0.5788188", "0.57588476", "0.5754331", "0.57366973", "0.57364887", "0.566453", "0.56602037", "0.56457216", "0.5645187", "0.5595208", "0.55886877", "0.55674803" ]
0.6860155
0
Get blog id from domain name.
public function _get_blog_id($the_domain) { global $wpdb; $the_blog = $wpdb->get_row("SELECT blog_id FROM e_blogs where domain LIKE '%{$the_domain}'" ); if(isset($the_blog->blog_id)) { return $the_blog->blog_id; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_blog_id_from_url( $domain, $path = '/' ) {\n\tglobal $wpdb;\n\n\t$domain = strtolower( $domain );\n\t$path = strtolower( $path );\n\t$id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );\n\n\tif ( $id == -1 ) // blog does not exist\n\t\treturn 0;\n\telseif ( $id )\n\t\treturn (int) $id;\n\n\t$id = $wpdb->get_var( $wpdb->prepare( \"SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */\", $domain, $path ) );\n\n\tif ( ! $id ) {\n\t\twp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' );\n\t\treturn 0;\n\t}\n\n\twp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' );\n\n\treturn $id;\n}", "public function getIDBlog()\n {\n return $this->IDBlog;\n }", "public function get_domain( $blog_id = 0 ) {\n\t\tif ( ! empty( $blog_id ) && $domain = $this->get( 'domain', null, $blog_id ) ) {\n\t\t\treturn $domain;\n\t\t}\n\n\t\tif ( $this->site instanceof WP_Site ) {\n\t\t\treturn $this->site->domain;\n\t\t}\n\n\t\t$domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) );\n\n\t\tif ( substr( $domain, -3 ) === ':80' ) {\n\t\t\t$domain = substr( $domain, 0, -3 );\n\t\t\t$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );\n\t\t} else if ( substr( $domain, -4 ) === ':443' ) {\n\t\t\t$domain = substr( $domain, 0, -4 );\n\t\t\t$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );\n\t\t}\n\n\t\treturn $domain;\n\t}", "function get_blog_id_by_path( $path ) {\n\n\t\tglobal $wpdb;\n\n \t$blog_id = $wpdb->get_var( \"SELECT blog_id FROM {$wpdb->blogs} WHERE path = '{$path}'\" );\n\t\n \treturn $blog_id;\n\t}", "function get_domain_id($domain)\n {\n $xml = $this->domain_info($domain);\n $id = intval($xml->site->get->result->id);\n $id = (is_int($id)) ? $id : false;\n\n return $id;\n }", "function blog_domain() {\n\n\treturn blog_setting( 'domain' );\n\n}", "public function get_blog_by_id($blog_id)\r\n\t\t{\r\n\t\t\t$qry = \"SELECT id, domain, create_date, mod_date FROM \" . $this->tbl('blog') . \" WHERE id = !\";\r\n\t\t\treturn $this->db->row($qry, array($blog_id));\r\n\t\t}", "public function getBlogPostId(): int\n {\n return $this->blogPostId;\n }", "function sa_blog_domain(){\n\tglobal $current_blog;\n\tif(isset($current_blog)){\n\t\treturn $current_blog->domain;\n\t}\n\treturn str_replace('http://', '', get_option('siteurl'));\n}", "public function get_blog_by_domain($domain)\r\n\t\t{\r\n\t\t\t$qry = \"SELECT id, domain, create_date, mod_date FROM \" . $this->tbl('blog') . \" WHERE domain = ?\";\r\n\t\t\treturn $this->db->row($qry, array($domain));\r\n\t\t}", "function the_slug(){\n\tglobal $blog;\n\treturn $blog->the_slug();\n}", "protected function get_blogname() {\n\t\treturn wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);\n\t}", "public function promptForBlogID()\n {\n $query = new Zend_Gdata_Query('http://www.blogger.com/feeds/default/blogs');\n $feed = $this->gdClient->getFeed($query);\n $this->printFeed($feed);\n $input = getInput(\"\\nSelection\");\n\n //id text is of the form: tag:blogger.com,1999:user-blogID.blogs\n $idText = explode('-', $feed->entries[$input]->id->text);\n $this->blogID = $idText[2];\n print $this->blogID;\n }", "private function getSiteId( $name ) {\n $site = SiteFactory::instance($name);\n return $site->getId();\n }", "function bpdev_get_blog_author_id() {\n\t//if this is a single user blog, admin will not need this widgets as Bp profile for blogs will do that\n\t$author_id = null;\n\tif ( in_the_loop() ) {\n\t\t//inside post loop\n\t\t$author_id = get_the_author_meta('ID');\n\t} elseif ( is_singular() && ! is_buddypress() ) {\n\t\tglobal $wp_the_query;\n\t\t$author_id = $wp_the_query->posts[0]->post_author;\n\t} elseif ( is_author() ) {\n\t\tglobal $wp_the_query;\n\t\t$author_id = $wp_the_query->get_queried_object_id();\n\t}\n\n\treturn $author_id;\n\n}", "private function get_domain_id($posted_domain_id) {\n\n $domain_id = 0;\n\n if(isset($posted_domain_id)) {\n $domain_id = (int) Database::clean_string($posted_domain_id);\n\n /* Make sure the user has access to global additional domains */\n if($this->user->plan_settings->additional_global_domains) {\n $domain_id = database()->query(\"SELECT `domain_id` FROM `domains` WHERE `domain_id` = {$domain_id} AND (`user_id` = {$this->user->user_id} OR `type` = 1)\")->fetch_object()->domain_id ?? 0;\n } else {\n $domain_id = database()->query(\"SELECT `domain_id` FROM `domains` WHERE `domain_id` = {$domain_id} AND `user_id` = {$this->user->user_id}\")->fetch_object()->domain_id ?? 0;\n }\n\n }\n\n return $domain_id;\n }", "function select_id_post_by_slug($slug){\n\tglobal $wpdb;\n\treturn $wpdb->get_var(\"SELECT ID FROM wp_posts WHERE post_name = '$slug'\");\n}", "function get_blog_permalink( $blog_id, $post_id ) {\n\tswitch_to_blog( $blog_id );\n\t$link = get_permalink( $post_id );\n\trestore_current_blog();\n\n\treturn $link;\n}", "function findUserDomainID($username) {\n global $db;\n\n $domain_id = 1;\n $dbq = $db->execute(\"select domain_id from tblUserDomains where username='$username'\");\n $domain_id = $dbq->fields['domain_id'];\n if (!$domain_id) {\n $domain_id = 1;\n }\n return $domain_id;\n }", "private function getBlogEntryByBlogId($blog_id) {\n if (!empty($blog_id) && is_numeric($blog_id)) {\n $query = 'SELECT be.blog_id, be.title, be.body, be.user_id, be.created, be.modified, u.username ';\n $query .= 'FROM blog_entries be ';\n $query .= 'JOIN users u ON u.user_id = be.user_id ';\n $query .= 'WHERE blog_id = ' . $this->database->escapeString($blog_id);\n $result = $this->database->execute($query);\n if (!empty($result)) {\n $blog_entry = $result->fetch_object();\n }\n if (empty($blog_entry)) {\n throw new \\Exception('Error - get blog entry with blog id ' . $blog_id . ' failed');\n }\n }\n return $blog_entry;\n }", "public static function getId()\n {\n $id = str_replace('/', '-', $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);\n return $id;\n\n }", "function insert_blog($domain, $path, $site_id) {\n\tglobal $wpdb;\n\n\t$path = trailingslashit($path);\n\t$site_id = (int) $site_id;\n\n\t$result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );\n\tif ( ! $result )\n\t\treturn false;\n\n\t$blog_id = $wpdb->insert_id;\n\trefresh_blog_details( $blog_id );\n\n\twp_maybe_update_network_site_counts();\n\n\treturn $blog_id;\n}", "function get_by_blog_id( $blog_id = 0 ) {\n\t\tif ( isset( $this->objects[$blog_id] ) ) {\n\t\t\treturn $this->objects[$blog_id];\n\t\t}\n\n\t\treturn false;\n\t}", "function get_postid_by_slug( $slug ) {\r\n\tglobal $wpdb;\r\n\r\n\t// Check the posts table to see if slug exists\r\n\t$slug = $wpdb->get_results( \"SELECT `ID` FROM {$wpdb->posts} WHERE `post_name`='{$slug}'\" );\r\n\r\n\tif( $slug[0]->ID != 0 ) {\r\n\t\treturn $slug[0]->ID;\r\n\t}\r\n\r\n\treturn FALSE;\r\n}", "function env_site_id($domain) {\n $domain = str_replace(\".dev\", \".com\", $domain); // doesn't work for .nl\n //die(\"domain=$domain\");\n switch($domain) {\n case 'patina.tech' : return 100;\n case 'apartments-for-rent.com' : return 10;\n case 'youramsterdamhousing.com' : return 109;\n case 'canalapartments.com' : return 211;\n case 'syspensa.com' : return 213;\n case 'jordaanapartmentsamsterdam.com' : return 216;\n case 'kerrygroneng.com' : return 231;\n case 'vpatina.com' : return 247;\n case 'hitabrick.com' : return 263;\n case 'evolutionsports.nl' : return 265;\n case 'elastictools.io' : return 267;\n default: return 0;\n }\n}", "function blog_name() {\n\n\treturn blog_setting( 'name' );\n\n}", "function pxls_get_page_id( $page_name ) {\n\tglobal $wpdb;\n\treturn $wpdb->get_var( \"SELECT ID FROM $wpdb->posts WHERE post_name = '\".$page_name.\"'\" );\n}", "public function getBlogById($blog_id)\n\t{\n\t\t$query = $this->db->query(\"SELECT DISTINCT * FROM \" . DB_PREFIX . \"blog i LEFT JOIN \". DB_PREFIX . \"blog_description id ON (i.blog_id = id.blog_id) WHERE i.blog_id = '\" . (int)$blog_id . \"' AND id.language_id = '\" . (int)$this->config->get('config_language_id') . \"' AND i.status = '1'\");\n\n\t\treturn $query->row;\n\t}", "function get_blog_id_from_cap_key( $meta_key ) {\n global $wpdb;\n\n $pattern = '#' . $wpdb->base_prefix . '([0-9]+?)_capabilities#';\n preg_match( $pattern, $meta_key, $matches );\n\n $blog_id = isset( $matches[1] ) ? (int) $matches[1] : 0;\n\n if ( !is_multisite() && $blog_id == 0 )\n $blog_id = 1;\n\n return $blog_id;\n }", "function tbcf_get_attachment_id_by_url( $url ) {\n\n\t$parsed_url = explode( parse_url( WP_CONTENT_URL, PHP_URL_PATH ), $url );\n\n\t$this_host = str_ireplace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) );\n\t$file_host = str_ireplace( 'www.', '', parse_url( $url, PHP_URL_HOST ) );\n\n\tif ( ! isset( $parsed_url[1] ) || empty( $parsed_url[1] ) || ( $this_host != $file_host ) ) {\n\t\treturn;\n\t}\n\n\tglobal $wpdb;\n\n\t$attachment = $wpdb->get_col( $wpdb->prepare( \"SELECT ID FROM {$wpdb->prefix}posts WHERE guid RLIKE %s;\", $parsed_url[1] ) );\n\n\treturn $attachment[0];\n\n}" ]
[ "0.7773944", "0.70379984", "0.6834237", "0.6807237", "0.6721926", "0.65682817", "0.65352726", "0.65224093", "0.63818324", "0.6292568", "0.61898553", "0.61463785", "0.61384225", "0.61324686", "0.6129643", "0.6089554", "0.60437024", "0.60176253", "0.60037494", "0.59634745", "0.5942627", "0.5937336", "0.5931666", "0.5931417", "0.58956975", "0.5895576", "0.5883235", "0.58819044", "0.5828041", "0.5805776" ]
0.78582096
0
returns array of dirnames can be applied the joint
function getValidDirnames() { $ret = array() ; $module_handler =& xoops_gethandler( 'module' ) ; $modules = $module_handler->getList( null , true ) ; if( ! empty( $this->trustdirname ) ) { foreach( array_keys( $modules ) as $mydirname ) { $trustpath_file = XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/mytrustdirname.php' ; if( ! file_exists( $trustpath_file ) ) continue ; $mytrustdirname = '' ; require $trustpath_file ; if( $mytrustdirname == $this->trustdirname ) $ret[] = $mydirname ; } } else { $dirname = strtolower( substr( get_class( $this ) , strlen('D3pipesBlock') ) ) ; if( isset( $modules[ $dirname ] ) ) $ret[] = $dirname ; } return $ret ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getValidDirnames()\n\t{\n\t\t$ret = array() ;\n\t\t$module_handler =& xoops_gethandler( 'module' ) ;\n\t\t$modules = $module_handler->getObjects() ;\n\n\t\tforeach( $modules as $module ) {\n\t\t\t$trust_dirname = $module->getVar( 'trust_dirname' ) ;\n\t\t\tif( $trust_dirname == $this->trustdirname ) {\n\t\t\t\t$ret[] = $module->getVar('dirname') ;\n\t\t\t}\n\t\t}\n\n\t\treturn $ret ;\n\t}", "public function getPrefixDirs(): array;", "function getCreateDirectories() {\n\t\t$directories = parent::getCreateDirectories();\n\t\t$directories[] = 'journals';\n\t\treturn $directories;\n\t}", "public function relationNames()\n {\n return [\n 'targetkinerja'\n ];\n }", "public function getDirectories(): array\n {\n }", "abstract protected function getEntityDirectories(): array;", "function getPaths() : array;", "public function getDirectories()\n {\n return $this->dirs;\n }", "public function getDirectories(){\n\t\t$sql = \"select * from st_directories\";\n\t\t$data = $this->runRequest ( $sql );\n\t\treturn $data->fetchAll();\n\t}", "function get_dir_structure()\n\t{\n\t\t$return = array();\n\n\t\t//------------------------------------------\n \t\t// Get the folder names\n \t\t//------------------------------------------\n\n \t\t$dh = opendir( THIS_PATH );\n\n \t\twhile ( $file = readdir( $dh ) )\n \t\t{\n\t\t\tif ( is_dir( THIS_PATH.\"/\".$file ) )\n\t\t\t{\n\t\t\t\tif ( $file != \".\" && $file != \"..\" )\n\t\t\t\t{\n\t\t\t\t\tif ( strstr( $file, 'upg_' ) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$tmp = str_replace( \"upg_\", \"\", $file );\n\t\t\t\t\t\t$return[ $tmp ] = $tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n \t\t}\n\n \t\tclosedir( $dh );\n\n \t\tsort($return);\n\n \t\treturn $return;\n\t}", "public function getAllDirectoryNames(): array\n {\n $files = glob($this->articleBasePath . '*' , GLOB_ONLYDIR);\n $files = array_map(function(string $file) {\n return basename($file);\n }, $files);\n\n return $files;\n }", "public function getComponentDirs()\r\n {\r\n return $this->components_dir = array_merge(['ntc' => _COMPONENT_DIR_],\r\n $this->getComponentsDirFromModules(new ModuleRepository()), $this->getComponentsFromUsers());\r\n }", "public function checkFolders()\n\t{\n\t\t$checked = array();\n\n\t\tforeach ($this->dirs as $dir)\n\t\t{\n $path = base_path($dir);\n\n\t\t \t$writable = is_writable($path);\n\n\t\t \t$checked[] = array('path' => realpath($path), 'writable' => $writable);\n\n\t\t \tif ( ! $this->compatResults['problem']) {\n\t\t \t\t$this->compatResults['problem'] = $writable ? false : true;\n\t\t \t}\t\t \t\n\t\t}\n\t\t\n\t\treturn $checked;\n\t}", "private function getRemoteDirectoryList() : array\n {\n return Util\\Path::getDirectoryListFromAbsolutePath($this->remotePath->getPath());\n }", "public function getDirectoryList() : array\n {\n return $this->directoryList;\n }", "public function getBoundDirectories(): array\n {\n return $this->boundDirectories;\n }", "public function getSubDirectories();", "public function relationNames()\r\n {\r\n return [\r\n 'absensis',\r\n 'siswas'\r\n ];\r\n }", "public function getAttachmentDirs()\n\t{\n\t\tif ($this->smf_attach_folders === null)\n\t\t{\n\t\t\t$from_prefix = $this->config->from_prefix;\n\n\t\t\t$request = $this->db->query(\"\n\t\t\t\tSELECT value\n\t\t\t\tFROM {$from_prefix}settings\n\t\t\t\tWHERE variable='attachmentUploadDir';\");\n\t\t\tlist ($smf_attachments_dir) = $this->db->fetch_row($request);\n\n\t\t\t$this->smf_attach_folders = @unserialize($smf_attachments_dir);\n\n\t\t\tif (!is_array($this->smf_attach_folders))\n\t\t\t{\n\t\t\t\t$this->smf_attach_folders = array(1 => $smf_attachments_dir);\n\t\t\t}\n\t\t}\n\n\t\treturn $this->smf_attach_folders;\n\t}", "public function getDirectories()\n {\n return $this->directories;\n }", "public function getIddirectors()\n {\n return $this->hasMany(Director::className(), ['id' => 'iddirector'])->viaTable('directores_por_pelicula', ['idpelicula' => 'id']);\n }", "public function getCouplesPaths()\n\t{\n\t\t$couples = array();\n\t\tforeach ($this->test->couple as $couple)\n\t\t{\n\t\t\t$input = P::m($this->rootDirectory, (string)$couple['input']);\n\t\t\t$output = P::m($this->rootDirectory, (string)$couple['output']);\n\n\t\t\t$couples[$input] = $output;\n\t\t}\n\n\t\treturn $couples;\n\t}", "public function relationNames()\n {\n return [\n 'siswa',\n 'izinekskul',\n 'jadwalekskul'\n ];\n }", "public function relationNames()\n {\n return [\n 'pertanyaans'\n ];\n }", "public function getWritableDirs()\n {\n return $this->writableDirs;\n }", "public function relationNames()\r\n {\r\n return [\r\n 'jurusan',\r\n 'waliKelas',\r\n 'namaKelas',\r\n 'onKelasSiswas',\r\n 'siswas'\r\n ];\r\n }", "function selectDirs($relPath, $fileList)\n{\n\tglobal $relPathG;\n\t$relPathG = $relPath;\n\t$filteredList = array_filter($fileList, \"fileIsDir\");\n\treturn $filteredList;\n}", "protected function getAllBaseNames()\n {\n $pluggables = [];\n\n $path = $this->getPath();\n\n if (!is_dir($path)) {\n return $pluggables;\n }\n\n $folders = $this->files->directories($path);\n\n foreach ($folders as $plug) {\n $pluggables[] = basename($plug);\n }\n\n return $pluggables;\n }", "public function dirs()\n {\n return $this->getMatchingFilesAndDirs(true);\n }", "public function getDirectoryParts(): array\n {\n return $this->aboveBaseLevelCount === 0 ? $this->directoryParts : array_merge(array_fill(0, $this->aboveBaseLevelCount, '..'), $this->directoryParts);\n }" ]
[ "0.6086064", "0.56566447", "0.5629573", "0.5546316", "0.5500065", "0.54370975", "0.533385", "0.5311377", "0.526037", "0.5248882", "0.5244531", "0.5231256", "0.516495", "0.51517326", "0.51429844", "0.5137001", "0.5126165", "0.5108395", "0.5100556", "0.509951", "0.5085522", "0.5067165", "0.50624245", "0.50271225", "0.5025566", "0.5023468", "0.5017272", "0.501687", "0.5004773", "0.49978155" ]
0.5947395
1
To enable/disable runtime hooks in coroutines. For backwardcompatible reason, there are four different ways to call this method: 1. Swoole\Runtime::enableCoroutine(); // Enable runtime hooks represented by constant SWOOLE_HOOK_ALL. 2. Swoole\Runtime::enableCoroutine($flags); // Enable specified runtime hooks. 3. Swoole\Runtime::enableCoroutine(true, $flags); // Enable specified runtime hooks. 4. Swoole\Runtime::enableCoroutine(false); // Disable runtime hooks. Following statements are of the same (when used to disable runtime hooks): Swoole\Runtime::enableCoroutine(0); // 2 Swoole\Runtime::enableCoroutine(true, 0); // 3 Swoole\Runtime::enableCoroutine(false); // 4
public static function enableCoroutine(bool|int $enable = SWOOLE_HOOK_ALL, int $flags = SWOOLE_HOOK_ALL): bool { if (PHP_SAPI !== 'cli') { // An E_ERROR level error will be thrown out here. return false; } if (is_int($enable)) { $flags = max(0, $enable); } elseif (is_bool($enable)) { if ($enable === false) { // Disable runtime hooks. $flags = 0; } } else { throw new \ErrorException('... expects parameter 1 to be boolean or integer, ...'); } return self::setHookFlags($flags); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function set_hooks()\n {}", "public function enable();", "public function enable();", "protected static function registerHookCallbacks() {\n throw new \\RuntimeException(\"Unimplemented\");\n }", "public static function isSupportCoroutine(): bool\n {\n if (version_compare(swoole_version(), '2.0.11', '>=')) {\n return true;\n } else {\n return App::isWorkerStatus();\n }\n }", "public static function shouldWrapCoroutine()\n {\n return App::isWorkerStatus() && version_compare(swoole_version(), '2.0.11', '>=');\n }", "public function enable() {\n parent::enable();\n \n $this->hooks->register('preRconSay', [$this, 'replaceMessage']);\n $this->hooks->register('preRconTell', [$this, 'replaceMessage']);\n }", "public static function setHookFlags(int $flags): bool\n {\n }", "abstract public function hooks();", "abstract public function registerHooks();", "public function onEnable() : void {\r\n }", "protected function hooks(){}", "public function registerHooks();", "function hook_enable() {\n mymodule_cache_rebuild();\n}", "public function enable() {\n }", "function pcntl_enabled()\n{\n $requiredFunctions = ['pcntl_signal', 'pcntl_signal_dispatch', 'pcntl_waitpid'];\n $disabledFunctions = explode(',', (string) ini_get('disable_functions'));\n $disabledFunctions = array_map(function ($item) {\n return trim($item);\n }, $disabledFunctions);\n\n foreach ($requiredFunctions as $function) {\n if (in_array($function, $disabledFunctions)) {\n return false;\n }\n }\n\n return true;\n}", "public static function run() {\n\t\tself::get()->_add_hooks();\n\t}", "public function hook();", "public static function enable()\n {\n self::$enabled = true;\n }", "public function preHook()\r\n {\r\n return TRUE;\r\n }", "function addHooks() {\n\t}", "public function supportsHookSubscribers()\n {\n return true;\n }", "public function supportsHookSubscribers()\n {\n return true;\n }", "public function addHooks() {\n\t\t// Hooks go here\n\t}", "public function enable()\n {\n $this->enabled = true;\n\n if (!$this->booted) {\n $this->boot();\n }\n }", "public function supportsHookSubscribers(): bool\n {\n return true;\n }", "function set_magic_hooks(){\r\n\t\t$class = new ReflectionClass(get_class($this));\r\n\t\t$methods = $class->getMethods();\r\n\t\t\r\n\t\tforeach ($methods as $method){ /** @var ReflectionMethod $method */\r\n\t\t\t//Check if the method name starts with \"hook_\"\r\n\t\t\tif (strpos($method->name, 'hook_') === 0){\r\n\t\t\t\t//Get the hook's tag from the method name \r\n\t\t\t\t$hook = substr($method->name, 5);\r\n\t\t\t\t//Add the hook. Uses add_filter because add_action is simply a wrapper of the same.\r\n\t\t\t\tadd_filter($hook, array($this, $method->name),\r\n\t\t\t\t\t$this->get_magic_hook_priority(), $method->getNumberOfParameters());\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tunset($class);\r\n\t}", "private function hooks() {\n }", "private function register_hooks() {\n\t\tforeach ( $this->get_hooking_classes() as $class ) {\n\t\t\t$full_class_name = ( $this->namespace . '\\\\' . $class );\n\t\t\t$reflection = new \\ReflectionClass( $full_class_name );\n\n\t\t\tif ( $reflection->implementsInterface( 'UTEC\\Common\\Interfaces\\Has_Hooks' ) ) {\n\t\t\t\t( new $full_class_name() )->hooks();\n\t\t\t}\n\t\t}\n\t}", "public function turnOn()\n {\n if ($this->isOn) {\n $this->turnOff();\n }\n\n $this->enableLibraryHooks();\n $this->isOn = true;\n }" ]
[ "0.5318287", "0.51583457", "0.51583457", "0.51508254", "0.51134187", "0.5003506", "0.4989942", "0.49845344", "0.49786633", "0.4961257", "0.49151045", "0.48862845", "0.48675025", "0.48268285", "0.47849408", "0.47680375", "0.4757918", "0.47060364", "0.46727556", "0.4669158", "0.46680382", "0.46617705", "0.46617705", "0.46458232", "0.46410877", "0.46331066", "0.46069947", "0.4583248", "0.45720708", "0.4556439" ]
0.711453
0
Get current runtime hook flags.
public static function getHookFlags(): int { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getFlags();", "public function getFlags();", "public function getFlags()\n {\n return $this->flags;\n }", "public function getFlags()\n {\n return $this->flags;\n }", "public function getFlags()\n {\n return $this->flags;\n }", "public function getFlags()\n {\n return $this->flags;\n }", "public function getFlags()\n {\n return $this->flags;\n }", "public function getFlags()\n {\n return $this->flags;\n }", "public function getGlobalFlags()\n {\n $this->reader->seek($this->offset + 10);\n\n return $this->readLong() & self::MASK;\n }", "public abstract function get_hooks();", "protected static function getAllHooks () {\n\t\treturn self::$hooks;\n\t}", "protected static function getAllHooks () {\n\t\treturn self::$hooks;\n\t}", "public function getFlags(): int\n {\n return $this->flags;\n }", "public function getFlags(): int {\n return $this->flags;\n }", "public function get()\n {\n return $this->flags;\n }", "public function getFlag()\n {\n return $this->get(self::FLAG);\n }", "public function getFlags(): array;", "public function getSystemFlags()\n {\n return $this->getFirstAttribute($this->schema->systemFlags());\n }", "public function getHooks();", "public function getFlags() : int\r\n {\r\n return 0;\r\n }", "public static function getCallbacks() {\n return Hook::$hooks;\n }", "public function getHooks()\n {\n return $this->_hooks;\n }", "public static function flags() {\n\t\t $obj = new CMS_Record_Flag;\n\t\t return $obj->fetch(array(\"table\" => static::$table));\n\t}", "public function hooks(): array;", "public function getStatusFlags()\n {\n // Initialise:\n \n $flags = [];\n \n // Is Extended Object Versioned?\n \n if ($this->owner->hasExtension(Versioned::class)) {\n \n if ($this->owner->isOnLiveOnly()) {\n \n // Extended Object Removed from Draft:\n \n $flags['removedfromdraft'] = array(\n 'text' => _t(__CLASS__ . '.ONLIVEONLYSHORT', 'On live only'),\n 'title' => _t(__CLASS__ . '.ONLIVEONLYSHORTHELP', 'Record is live, but removed from draft'),\n );\n \n } elseif ($this->owner->isArchived()) {\n \n // Extended Object Archived:\n \n $flags['archived'] = [\n 'text' => _t(__CLASS__ . '.ARCHIVEDSHORT', 'Archived'),\n 'title' => _t(__CLASS__ . '.ARCHIVEDHELP', 'Record is removed from draft and live')\n ];\n \n } elseif ($this->owner->isOnDraftOnly()) {\n \n // Extended Object Added to Draft:\n \n $flags['addedtodraft'] = [\n 'text' => _t(__CLASS__ . '.ADDEDTODRAFTSHORT', 'Draft'),\n 'title' => _t(__CLASS__ . '.ADDEDTODRAFTHELP', 'Record has not been published yet')\n ];\n \n } elseif ($this->owner->isModifiedOnDraft()) {\n \n // Extended Object Modified on Draft:\n \n $flags['modified'] = [\n 'text' => _t(__CLASS__ . '.MODIFIEDONDRAFTSHORT', 'Modified'),\n 'title' => _t(__CLASS__ . '.MODIFIEDONDRAFTHELP', 'Record has unpublished changes')\n ];\n \n }\n \n }\n \n // Apply Extensions:\n \n $this->owner->extend('updateStatusFlags', $flags);\n \n // Answer Flags:\n \n return $flags;\n }", "public function getFlaggings() {\n return $this->flaggings;\n }", "public function getHooks()\n {\n return $this->hooks;\n }", "public function get_current_hook() {\n\n return \\current_filter();\n\n }", "protected function getHooks()\n {\n $hooks = LogicHook::initialize()->getHooks('application');\n\n return $hooks['after_save'];\n }", "function tsml_custom_flags($flags) {\n\tglobal $tsml_programs, $tsml_program;\n\t$tsml_programs[$tsml_program]['flags'] = $flags;\n}" ]
[ "0.6754892", "0.6754892", "0.6460865", "0.6460865", "0.6460865", "0.6460865", "0.6460865", "0.6460865", "0.6361418", "0.61504316", "0.61285245", "0.61285245", "0.6085492", "0.6054741", "0.5984371", "0.59764653", "0.5902941", "0.5878653", "0.5753518", "0.57229775", "0.57173634", "0.5650862", "0.56388056", "0.56297195", "0.5620808", "0.56114125", "0.5586577", "0.55842", "0.55826074", "0.55202943" ]
0.81637746
0
Set runtime hook flags. This overrides any flags set previously. Here are some examples of setting runtime hook flags: setHookFlags(SWOOLE_HOOK_TCP): Enable TCP hook only. setHookFlags(SWOOLE_HOOK_TCP | SWOOLE_HOOK_UDP | SWOOLE_HOOK_SOCKETS): Enable TCP, UDP and socket hooks. setHookFlags(SWOOLE_HOOK_ALL): Enable all runtime hooks. setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_FILE ^ SWOOLE_HOOK_STDIO): Enable all runtime hooks except file and stdio hooks. setHookFlags(0): Disable runtime hooks.
public static function setHookFlags(int $flags): bool { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function set_hooks()\n {}", "public function setHooks( Hooks $hooks );", "abstract public function hooks();", "public static function getHookFlags(): int\n {\n }", "function set_magic_hooks(){\r\n\t\t$class = new ReflectionClass(get_class($this));\r\n\t\t$methods = $class->getMethods();\r\n\t\t\r\n\t\tforeach ($methods as $method){ /** @var ReflectionMethod $method */\r\n\t\t\t//Check if the method name starts with \"hook_\"\r\n\t\t\tif (strpos($method->name, 'hook_') === 0){\r\n\t\t\t\t//Get the hook's tag from the method name \r\n\t\t\t\t$hook = substr($method->name, 5);\r\n\t\t\t\t//Add the hook. Uses add_filter because add_action is simply a wrapper of the same.\r\n\t\t\t\tadd_filter($hook, array($this, $method->name),\r\n\t\t\t\t\t$this->get_magic_hook_priority(), $method->getNumberOfParameters());\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tunset($class);\r\n\t}", "public function setHooks($hooks) {\r\n\t\t$this->hooks = $hooks;\r\n\t}", "public function initHooks() {\n\t\t\tif (AppLoader::includeHooks('CommonHooks')) {\n\t\t\t\t$objCommonHooks = new CommonHooks();\n\t\t\t\t$this->registerPreRunHook(array($objCommonHooks, 'verifyToken'));\n\t\t\t\t$this->registerPostRunHook(array($objCommonHooks, 'trackHistory'), array(5, array('css', 'js', 'xml', 'json', 'jsonp', 'html')));\n\t\t\t}\n\t\t\t\t\n\t\t\tif (AppLoader::includeHooks('CacheHooks')) {\n\t\t\t\t$objCacheHooks = new CacheHooks();\n\t\t\t\t$this->registerPreRunHook(array($objCacheHooks, 'serveCache'));\n\t\t\t\t$this->registerPostRunHook(array($objCacheHooks, 'saveCache'));\n\t\t\t}\n\t\t}", "public function hook();", "function set_hooks( $tags = array() ) {\r\n global $ipHooks;\r\n return $ipHooks->setHooks( $tags );\r\n}", "private function hooks() {\n }", "public function addHooks() {\n\t\t// Hooks go here\n\t}", "public function set_hooks()\n\t{\n\t\tadd_action('init', 'register_tlc_post_types');\n\t\tadd_action('generate_rewrite_rules', 'register_tlc_rewrite_rules');\n\t\tadd_filter(\"rest_prepare_services\", 'tlc_rest_prepare_post', 10, 3);\n\t\tadd_filter(\"rest_prepare_events\", 'tlc_rest_prepare_post', 10, 3);\n\t\tadd_filter(\"rest_prepare_page\", 'tlc_rest_prepare_post', 10, 3);\n\t}", "function addHooks() {\n\t}", "private function update_hooks()\n\t{\n\t\t$this->delete_hooks();\n\t\t$this->create_hooks();\n\t}", "function setFlagBits() {\n $this->flags = 0;\n\n // Note: NULL == \"\" so checking for 0 length string is not needed.\n if ($this->ip != NULL) {\n $this->flags = $this->flags | $this->FLAG_IP;\n }\n if ($this->path != NULL) {\n $this->flags = $this->flags | $this->FLAG_PATH;\n }\n if ($this->profile != NULL) {\n $this->flags = $this->flags | $this->FLAG_PROFILE;\n }\n if ($this->password != NULL) {\n $this->flags = $this->flags | $this->FLAG_PASSWD;\n }\n if ($this->window > 0) {\n $this->flags = $this->flags | $this->FLAG_WINDOW;\n }\n if ($this->payload != NULL) {\n $this->flags = $this->flags | $this->FLAG_PAYLOAD;\n }\n if ($this->duration > 0) {\n $this->flags = $this->flags | $this->FLAG_DURATION;\n }\n }", "public static function initHooks() {\n\n\t}", "protected function hooks(){}", "abstract public function registerHooks();", "protected function init_hooks()\n\t{\n\t}", "private function register_hooks() {\n\t\tforeach ( $this->get_hooking_classes() as $class ) {\n\t\t\t$full_class_name = ( $this->namespace . '\\\\' . $class );\n\t\t\t$reflection = new \\ReflectionClass( $full_class_name );\n\n\t\t\tif ( $reflection->implementsInterface( 'UTEC\\Common\\Interfaces\\Has_Hooks' ) ) {\n\t\t\t\t( new $full_class_name() )->hooks();\n\t\t\t}\n\t\t}\n\t}", "function hook_flag_options_alter(array &$options, FlagInterface $flag) {\n\n}", "private function set_hooks() {\n\t\tadd_action( 'admin_enqueue_scripts', array( $this, 'page_scripts' ) );\n\t\tadd_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 11, 3 );\n\t}", "protected static function registerHookCallbacks() {\n throw new \\RuntimeException(\"Unimplemented\");\n }", "private function create_hooks()\n\t{\n\t\tglobal $DB;\n\n\t\t$hook_template = array(\n\t\t\t'class' => __CLASS__,\n\t\t\t'settings' => FALSE,\n\t\t\t'version' => $this->version,\n\t\t);\n\n\t\tforeach($this->hooks as $key => $value)\n\t\t{\n\t\t\tif(is_array($value))\n\t\t\t{\n\t\t\t\t$hook[\"hook\"] = $key;\n\t\t\t\t$hook[\"method\"] = (isset($value[\"method\"]) === TRUE) ? $value[\"method\"] : $key;\n\t\t\t\t$hook = array_merge($hook, $value);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$hook[\"hook\"] = $hook[\"method\"] = $value;\n\t\t\t}\n\t\t\t$hook = array_merge($hook_template, $hook);\n\t\t\t$DB->query($DB->insert_string('exp_extensions', $hook));\n\t\t}\n\t}", "public abstract function get_hooks();", "function tsml_custom_flags($flags) {\n\tglobal $tsml_programs, $tsml_program;\n\t$tsml_programs[$tsml_program]['flags'] = $flags;\n}", "public function hookInit() {\r\n\r\n }", "public function hook_init() { }", "public function registerHooks();", "public function hooks() {\n\t\tadd_action( 'plugins_loaded', array( $this, 'write' ) );\n\t\tadd_action( 'admin_init', array( $this, 'deactivate' ) );\n\t\tadd_action( 'admin_notices', array( $this, 'admin_notices' ) );\n\t}" ]
[ "0.628052", "0.5925737", "0.58609617", "0.5824195", "0.56513166", "0.56504387", "0.5505517", "0.5500645", "0.5484785", "0.5408916", "0.53786", "0.53586656", "0.5339042", "0.53120273", "0.52635664", "0.5259041", "0.5228231", "0.5222791", "0.5222501", "0.5210775", "0.5210706", "0.5145348", "0.5136016", "0.5106778", "0.51061326", "0.50789136", "0.5062073", "0.5035628", "0.5030768", "0.5013688" ]
0.622928
1
update last action time to the current time for logged user or insert new record if user made first action
public function updateLastActionTime() { $currentTime = time(); $affectedRows = 0; $command = Yii::app()->db->createCommand(' SELECT id FROM user_login WHERE user_id=? '); $rowId = $command->queryScalar(array(1=>$this->id)); if ( $rowId ) { $command = Yii::app()->db->createCommand(' UPDATE user_login SET last_action_time= :currentTime, user_agent= :userAgent WHERE user_id= :userId '); $affectedRows = $command->execute(array( 'userId' => $this->id, 'currentTime' => $currentTime, 'userAgent' => $_SERVER['HTTP_USER_AGENT'], )); } else { $command = Yii::app()->db->createCommand(' INSERT INTO user_login (user_id,last_action_time,user_agent) VALUE (:userId, :currentTime, :userAgent) '); $affectedRows = $command->execute(array( 'userId' => $this->id, 'currentTime' => $currentTime, 'userAgent' => $_SERVER['HTTP_USER_AGENT'], )); } return $affectedRows; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLastAction($action)\n{\n\tif (!$this->user) return false;\n\t\n\t$this->callHook(\"updateLastAction\", array(&$action));\n\t\n\tglobal $config;\n\t$action = $this->db->escape(substr($action, 0, 255));\n\t$query = \"UPDATE {$config[\"tablePrefix\"]}members SET lastAction='$action', lastSeen=\" . time() . \" WHERE memberId={$this->user[\"memberId\"]}\";\n\t$this->user[\"lastSeen\"] = $_SESSION[\"user\"][\"lastSeen\"] = time();\n\t$this->user[\"lastAction\"] = $_SESSION[\"user\"][\"lastAction\"] = $action;\n\t$this->db->query($query);\n}", "public function update_activity_time () {\n # update\n try { $this->Database->updateObject(\"users\", array(\"lastActivity\"=>date(\"Y-m-d H:i:s\"), \"id\"=>$this->user->id)); }\n catch (Exception $e) { }\n }", "public function updateLoginTime()\n {\n $loginRecord = new UserLoginHistory;\n $loginRecord->user_id = $this->id;\n $loginRecord->ip_address = $_SERVER['REMOTE_ADDR'];\n $loginRecord->login_time = date('Y-m-d H:i:s');\n $loginRecord->user_agent = $_SERVER['HTTP_USER_AGENT'];\n $loginRecord->save();\n }", "public function updateUserLastAccess()\n {\n $user = Doctrine::getTable('User')->find($this->getUserId());\n if ($user)\n {\n // not using the date formatter because this method can be called before the formatter exists\n $user->setLastAccessAt(date('Y-m-d H:i:s'));\n $user->save();\n }\n }", "function fua_force_last_activity_meta() {\nglobal $wpdb;\n\t\n\tif( !is_super_admin() )\n\t\treturn;\n\t\n\tif( isset($_GET['action']) && $_GET['action'] == 'force-active' ) {\n\n\t\t\n\t\t$sql = \"SELECT `ID` FROM {$wpdb->users}\";\n\t\t$fua_user_ids = $wpdb->get_col($sql);\n\t\n\t\tforeach($fua_user_ids as $fua_user_id){\n\t\n\t\t$last_activity_exists = BP_Core_User::get_last_activity( $fua_user_id );\n\n\t\n\t\t\tif( count($last_activity_exists) <= 1 ) {\n\t\t\t\tbp_update_user_last_activity($fua_user_id, date('Y-m-d H:i:s') );\n\t\t\t\t// Lets try and get a different time stamp for each entry\n\t\t\t\tsleep(2);\t\n\t\t\t} \n\t\t} // close foreach\n\t} // close get action\n\n}", "function update_last_activity() {\n\t\t$update = new ElUser;\n\t\t$update->update_last_activity();\n}", "public function updateLogoutTime()\n {\n $loginRecord = UserLoginHistory::where(['user_id' => $this->id])->orderBy('id', 'desc')->first();\n $loginRecord->logout_time = date('Y-m-d H:i:s');\n $loginRecord->save();\n }", "public function setAccessTime(){\r\n\t\t$query = $this->dbh->prepare(\"UPDATE \".DB_PREFIX.\"_user set online=:time where uid=:uid\");\r\n\t\t$query->execute(array(':time'=>time(),':uid'=>$this->uid));\t\t\r\n\t}", "private function _update_last_action($user_id)\n {\n $this->cgit_auth_model->set_last_action($user_id);\n }", "public function save() {\n // Do not automatically set a created values for already existing entities.\n if (empty($this->created) && (!empty($this->is_new) || !$this->id)) {\n $this->created = REQUEST_TIME;\n }\n\n $this->changed = REQUEST_TIME;\n\n parent::save();\n }", "public static function update_user_activity($request) {\n if ($request && $request->token && $request->token->token_type == \"access\") {\n Db::execute(\"\n update user set last_login=now()\n where user_id='\".Db::escape_string($request->token->user_id).\"'\n \");\n }\n }", "public function touchOnLogin() {\n\t\tYii::trace('User->touchOnLogin() user=' . $this->id);\n\t\t$this->last_login = new CDbExpression('NOW()');\n\t\t$this->last_login_ip = Yii::app()->request->userHostAddress;\n\t\treturn $this->update(array('last_login', 'last_login_ip'));\n\t}", "private function _record_user_action(){\n\t\t\t$this->class_settings[\"calling_page\"] = $_SERVER[\"DOCUMENT_ROOT\"].'/'.HYELLA_INSTALL_PATH;\n\t\t\t$this->class_settings[\"user_id\"] = \"anonymous\";\n\t\t\t$this->class_settings[\"user_email\"] = \"anonymous\";\n\t\t\t\n\t\t\t$stamp = $this->_new_day();\n\t\t\t\n $trail = array();\n \n\t\t\t//Get Current File\n\t\t\t$filename = $this->class_settings[\"calling_page\"] . 'tmp/'.$this->trail.'/'.$stamp.'.json';\n\t\t\tif( file_exists( $filename ) ){\n\t\t\t\t$trail = json_decode( file_get_contents( $filename ) , true );\n }\n \n\t\t\t$cu = md5( 'ucert' . $_SESSION['key'] );\n\t\t\t\n\t\t\tif( isset( $_SESSION[ $cu ][\"id\"] ) ) {\n\t\t\t\t$this->class_settings[\"user_id\"] = $_SESSION[ $cu ][\"id\"];\n\t\t\t\t$this->class_settings[\"user_email\"] = $_SESSION[ $cu ][\"fname\"] . ' ' . $_SESSION[ $cu ][\"lname\"] .' ( '. $_SESSION[ $cu ][\"email\"] . ' )';\n\t\t\t}\n\t\t\t\n\t\t\t//Prepare new content\n\t\t\t$date = date(\"U\");\n\t\t\t$ip = get_ip_address();\n\t\t\t$trail[] = array( 'user'=> $this->class_settings[\"user_id\"], 'user_mail' => isset( $this->class_settings[\"user_full_name\"] )?$this->class_settings[\"user_full_name\"]:$this->class_settings[\"user_email\"], 'user_action'=>$this->user_action, 'table'=>$this->table, 'comment'=>$this->comment, 'date'=>$date, 'ip_address'=>$ip );\n\t\t\t\n\t\t\t//Write file\n if( ! empty( $trail ) ){\n file_put_contents( $filename , json_encode( $trail ) );\n }\n\t\t\t/*\n\t\t\t$stamp = $this->_new_day();\n\t\t\t\n $trail = array();\n \n\t\t\t//Get Current File\n\t\t\t$filename = $this->class_settings['calling_page'].'tmp/'.$this->trail.'/'.$stamp.'.json';\n\t\t\tif( file_exists( $filename ) ){\n\t\t\t\t$trail = json_decode( file_get_contents( $filename ) , true );\n }\n \n\t\t\t//Prepare new content\n\t\t\t$date = date(\"U\");\n\t\t\t$ip = get_ip_address();\n\t\t\t$trail[] = array( 'user'=> $this->class_settings[\"user_id\"], 'user_mail' => isset( $this->class_settings[\"user_full_name\"] )?$this->class_settings[\"user_full_name\"]:$this->class_settings[\"user_email\"], 'user_action'=>$this->user_action, 'table'=>$this->table, 'comment'=>$this->comment, 'date'=>$date, 'ip_address'=>$ip );\n\t\t\t\n\t\t\t//Write file\n if( ! empty( $trail ) ){\n file_put_contents( $filename , json_encode( $trail ) );\n }\n\t\t\t*/\n\t\t}", "public function updateLastActive()\n\t{\n\t\t$this->lastActive = date('Y-m-d H:i:s');\n\t\t$this->save();\n\t}", "public function makeUnActive()\n {\n \n $command = Yii::app()->db->createCommand('\n UPDATE user_login \n SET last_action_time= :oldTime\n WHERE (user_id= :userId)\n ');\n return $command->execute(array(\n 'userId' => $this->id,\n 'oldTime' => 1,\n ));\n }", "public function usedNow()\n {\n $this->lastuse_at = new DateTime;\n $this->save();\n }", "function afterFilter() {\n if ($this->Auth->user()) {\n $this->loadModel('User');\n $this->User->id = $this->Auth->user('id');\n $this->User->saveField('last_access', date('Y-m-d H:i:s'));\n }\n }", "function afterFilter() {\n if ($this->Auth->user()) {\n $this->loadModel('User');\n $this->User->id = $this->Auth->user('id');\n $this->User->saveField('last_access', date('Y-m-d H:i:s'));\n }\n }", "public function updateLastActive() {\n\t\t$this -> setData(\"lastActive\", date(\"Y-m-d H:i:s\"));\n\t}", "function save() {\n\t\tif(!isset($this->timestamp)) {\n\t\t\t$this->timestamp = sql_datetime(time());\n\t\t}\n\t\t\n\t\tparent::save();\n\t}", "public function updateLoginDate()\n {\n $this->date_last_login = new Expression('NOW()');\n $this->save(false, ['date_last_login']);\n }", "function __commonAdmin_RegisterLastActive()\n {\n\n //update team member as last active now()\n $this->teamprofile_model->registerLastActive($this->session->userdata('team_profile_id'));\n\n }", "public function updateTime(){\r\n\t\t$date = new DateTime();\r\n\t\t$this->_lastUpdate = date_timestamp_get($date);\t\t\r\n\t}", "public function preSave() {\n parent::preSave();\n if(!$this->uid) {\n $this->uid = \\Drupal::currentUser()->id();\n }\n if(!$this->created) {\n $this->created = \\Drupal::time()->getRequestTime();\n }\n }", "function bbp_update_user_last_posted($user_id = 0, $time = 0)\n{\n}", "public static function lastActivityTime() \n {\n if (isset($_SESSION['LastActivity']) && (time() - $_SESSION['LastActivity'] > 2592000)) {\n\n // last request was more than 1 month ago\n session_unset();\n session_destroy();\n }\n\n // Update the last activity timestamp\n $_SESSION['LastActivity'] = time();\n }", "public function sess_action_time_set($action, $time = '')\n {\n $time = (int)$time;\n $time = (!$time) ? now() : $time;\n\n $this->sess_action_set('time', $action, $time);\n }", "function save_log($action = \"\")\r\n\t{\r\n\t\tglobal $INFO, $IN, $MEMBER;\r\n\t\t$ibforums = Ibf::app();\r\n\r\n\t\t$data = [\r\n\t\t\t'act' => $IN['act'],\r\n\t\t\t'code' => $IN['code'],\r\n\t\t\t'member_id' => $MEMBER['id'],\r\n\t\t\t'ctime' => time(),\r\n\t\t\t'note' => $action,\r\n\t\t\t'ip_address' => $IN['IP_ADDRESS'],\r\n\t\t];\r\n\r\n\t\t$ibforums->db->insertRow(\"ibf_admin_logs\", $data);\r\n\r\n\t\treturn true; // to anyone that cares..\r\n\r\n\t}", "function last_time_activity_session($act)\n{\n switch ($act) {\n case 'get':\n return isset($_SESSION['login_' . APP_PREFIX]['last_time_activity']) ? $_SESSION['login_' . APP_PREFIX]['last_time_activity'] : \"\";\n break;\n\n case 'renew':\n $_SESSION['login_' . APP_PREFIX]['last_time_activity'] = time();\n break;\n }\n}", "public function touch()\n\t{\n\t\tif ($this->id()) {\n\t\t\t$usersTable = new Db\\UsersTable();\n\t\t\t$query = $usersTable->update();\n\t\t\t$query->values([\n\t\t\t\t\"updated\" => time()\n\t\t\t]);\n\t\t\t$query->where([\"id\" => $this->id()]);\n\t\t\t$query->execute();\n\t\t}\n\t}" ]
[ "0.693451", "0.6920957", "0.67272896", "0.66866904", "0.6542971", "0.6478922", "0.6429947", "0.63370484", "0.63158804", "0.62752724", "0.62698895", "0.6225049", "0.62073255", "0.6200498", "0.61430556", "0.61265546", "0.60855085", "0.60855085", "0.60771096", "0.60572565", "0.6052164", "0.6044857", "0.6041162", "0.60300964", "0.59707576", "0.59363544", "0.593329", "0.5900104", "0.58950716", "0.5867392" ]
0.7805105
0
Tests fetching a file without any errors.
public function testSuccessfulFetch(): void { $this->mockHandler->append(new Response(200, [], $this->testContent)); $fetcher = new GuzzleFileFetcher($this->client); $this->assertSame($fetcher->fetchFile('test.json', 256), $this->testContent); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function test_check_file_method_for_nonexistent_file()\n {\n $result = web_service::check_file($this->nonexistent_url);\n\n $this->assertInternalType('array', $result);\n $this->assertArrayHasKey('status', $result);\n $this->assertArrayHasKey('code', $result);\n $this->assertFalse($result['status']);\n $this->assertContains($result['code'], array(\n 404,\n 0,\n ));\n }", "public function testReadFile ()\n {\n $offset = 1;\n $length = 3;\n\n $response = $this->getWebResponse('getFile_success');\n\n $web = $this->getMock('\\\\Hdfs\\\\Web\\\\WebHdfsWrapper');\n $web->expects($this->once())\n ->method('exec')\n ->with(Method::GET, self::REMOTE_FILE, 'OPEN', array('offset' => $offset, 'length' => $length))\n ->will($this->returnValue($response));\n\n $entry = $this->getMockBuilder('\\\\Hdfs\\\\EntryStatus')->disableOriginalConstructor()->getMock();\n $entry->method('isFile')->will($this->returnValue(true));\n\n $hdfs = $this->getMock('\\\\Hdfs\\\\Web', array('stat'));\n $hdfs->method('stat')->with(self::REMOTE_FILE)->will($this->returnValue($entry));\n $hdfs->setWebHdfsWrapper($web);\n\n $read = $hdfs->readFile(self::REMOTE_FILE, $offset, $length);\n\n $expected = $response->getFileContent();\n $this->assertEquals($expected, $read);\n }", "public function testRemoteFile()\n {\n $url = 'https://www.google.com/';\n $crawler = new Crawler($url, 1);\n $crawler->traverse();\n $links = $crawler->getLinks();\n $this->assertEquals(get_class($crawler->getScrapClient()), \\Goutte\\Client::class);\n\n $this->assertEquals($links['https://www.google.com/']['status_code'], 200, $url.' shall be 200 ok');\n $this->assertGreaterThan(3, count($links));\n }", "abstract protected function fetchFromFile();", "public function testFileNotExist()\n {\n $crawler = new Crawler('test', 1, ['localFile'=>true]); //non existing url/path\n\n $crawler->traverse();\n $ret = $crawler->getLinks();\n \n $this->assertArrayHasKey('test', $ret);\n $this->assertEquals($ret['test']['status_code'], 404);\n }", "public function testVerifiedDownload(): void\n {\n $fixtureName = 'Simple';\n $updater = $this->getSystemInTest($fixtureName);\n\n $testFilePath = static::getFixturePath($fixtureName, 'server/targets/testtarget.txt', false);\n $testFileContents = file_get_contents($testFilePath);\n $this->assertSame($testFileContents, $updater->download('testtarget.txt')->getContents());\n\n // If the file fetcher returns a file stream, the updater should NOT try\n // to read the contents of the stream into memory.\n $stream = $this->prophesize('\\Psr\\Http\\Message\\StreamInterface');\n $stream->getMetadata('uri')->willReturn($testFilePath);\n $stream->getContents()->shouldNotBeCalled();\n $stream->rewind()->shouldNotBeCalled();\n $stream->getSize()->willReturn(strlen($testFileContents));\n $updater->download('testtarget.txt');\n\n // If the target isn't known, we should get an exception.\n try {\n $updater->download('void.txt');\n $this->fail('Expected a NotFoundException to be thrown, but it was not.');\n } catch (NotFoundException $e) {\n $this->assertSame('Target not found: void.txt', $e->getMessage());\n }\n\n $stream = Utils::streamFor('invalid data');\n $this->serverStorage->fileContents['testtarget.txt'] = $stream;\n try {\n $updater->download('testtarget.txt');\n $this->fail('Expected InvalidHashException to be thrown, but it was not.');\n } catch (InvalidHashException $e) {\n $this->assertSame(\"Invalid sha256 hash for testtarget.txt\", $e->getMessage());\n $this->assertSame($stream, $e->getStream());\n }\n }", "public function testFailDownloadFromUrl()\n {\n // Create an ImageCachingManager object which will fail\n $logger = $this->createMock(LoggerInterface::class);\n // simulate cURL failing to download file\n $curlWrapper = $this->createMock(CurlWrapper::class);\n $curlWrapper->method('download')\n ->willThrowException(new \\Exception('HTTP 404'));\n $filesystem = $this->createMock(FilesystemAbstraction::class);\n $filesystem->method('saveToDisk')\n ->willReturn(true);\n $failingImageCachingManager = new ImageCachingManager(self::CACHE_DIR, self::PUBLIC_DIR, $logger, $curlWrapper, $filesystem);\n\n $localPath = $failingImageCachingManager->downloadFromUrl(self::IMAGE_URL, self::RECORD_ID);\n\n // Function downloadFromUrl() should return false\n $this->assertEquals(false, $localPath);\n // Error should not be empty!\n $this->assertEquals(true, !empty($failingImageCachingManager->getErrorMessage()));\n }", "public function testGetFileWithoutErrors ()\n {\n $fs = $this->getMock('\\\\Hdfs\\\\FilesystemWrapper');\n $fs->method('isWritable')->will($this->returnValue(true));\n $fs->method('isExists')->will(\n $this->returnValueMap(\n array(\n array(self::LOCAL_DIR, true),\n array(self::LOCAL_FILE, false)\n )\n )\n );\n $fs->expects($this->once())\n ->method('saveFile')\n ->with(self::LOCAL_FILE, 'hello, hdfs');\n\n $response = $this->getWebResponse('getFile_success');\n\n $web = $this->getMock('\\\\Hdfs\\\\Web\\\\WebHdfsWrapper');\n $web->expects($this->once())\n ->method('exec')\n ->with(Method::GET, self::REMOTE_FILE, 'OPEN')\n ->will($this->returnValue($response));\n\n $entry = $this->getMockBuilder('\\\\Hdfs\\\\EntryStatus')->disableOriginalConstructor()->getMock();\n $entry->method('isFile')->will($this->returnValue(true));\n\n $hdfs = $this->getMock('\\\\Hdfs\\\\Web', array('stat'));\n $hdfs->method('stat')->with(self::REMOTE_FILE)->will($this->returnValue($entry));\n $hdfs->setFilesystemWrapper($fs);\n $hdfs->setWebHdfsWrapper($web);\n\n $hdfs->getFile(self::REMOTE_FILE, self::LOCAL_FILE);\n }", "#[@test]\n public function fromResource() {\n $this->assertNull(create(new File(fopen($this->fileKnownToExist(), 'r')))->getURI());\n }", "public function testFetcherInstantiation(): void\n {\n $hasError = false;\n try {\n $fetcher = new Fetcher('literally-some-random-path');\n } catch (Exception $e) {\n $hasError = true;\n }\n $this->assertTrue($hasError);\n\n // if credentials file exist, it should instantiate without error\n $hasError = false;\n try {\n $fetcher = new Fetcher(__DIR__ . '/TestCredentials.json');\n } catch (Exception $e) {\n $hasError = true;\n }\n $this->assertFalse($hasError);\n\n /*\n not testing the batchGet call because it will be inconsistent across devices\n and sites, and it's not really testing the System Under Testing.\n */\n }", "private function fetchLocalResource($url)\n {\n try {\n $data = file_get_contents($url);\n $this->latestfile = $data;\n } catch (RequestException $e) {\n $this->errormessage = 'Error occurred during local fetch: ' . $e->getMessage();\n $this->latestfile = false;\n }\n }", "function grab_file_content($rawurl, $response = false) {\r\n\r\n\t$url = htmlspecialchars($rawurl, ENT_QUOTES | ENT_HTML5, 'UTF-8', false);\r\n\r\n if(filter_var($url, FILTER_VALIDATE_URL)) {\r\n $file_headers = @get_headers($url);\r\n if(!$file_headers || $file_headers[0] === 'HTTP/1.1 404 Not Found') { return $response; }\r\n }\r\n\r\n\tif(is_callable('curl_init')) {\r\n\t\t$ch = curl_init();\r\n\t\tcurl_setopt($ch, CURLOPT_HEADER, 0);\r\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\r\n\t\tcurl_setopt($ch, CURLOPT_URL, $url);\r\n\t\t$response = curl_exec($ch);\r\n\t\tcurl_close($ch);\r\n\t} \r\n\r\n\tif(empty($response) || !is_callable('curl_init')) {\r\n\t\t$opts = array('http'=>array('header' => 'Connection: close'));\r\n\t\t$context = stream_context_create($opts);\r\n\t\t$headers = get_headers($url);\r\n\t\t$httprequest = substr($headers[0], 9, 3);\r\n\t\tif($httprequest == '200') {\r\n\t\t\t$response = @file_get_contents($url, false, $context);\r\n\t\t}\r\n\t}\r\n\treturn $response;\r\n}", "public function testDownloadIfNew() {\n\t\t// Try to download the file (true if it did, false if not)\n\t\t$this->assertTrue(DataDownloader::downloadIfNew($this->fileToGrab, $this->filePath, $this->fileName, $this->fileExtension));\n\n\t\t// See what files are there\n\t\t$files = glob(\"$this->filePath$this->fileName*$this->fileExtension\");\n\n\t\t// See if they're there\n\t\t$this->assertNotEmpty($files);\n\t}", "public function fetchFile($url){\n\t\t$ch = curl_init($url);\n\t\tcurl_setopt($ch, CURLOPT_TIMEOUT, 50);\n\t\tcurl_setopt($ch, CURLOPT_URL, $url);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\n\t\t$result = curl_exec($ch);\n\t\tcurl_close($ch);\n\n\t\treturn $result;\n\t}", "function checkRemoteFile($url)\n{\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n // don't download content\n curl_setopt($ch, CURLOPT_NOBODY, 1);\n curl_setopt($ch, CURLOPT_FAILONERROR, 1);\n curl_setopt($ch, CURLOPT_HEADER, 1);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n $result = curl_exec($ch);\n if ($result !== FALSE)\n {\n return true;\n }\n else\n {\n return false;\n }\n}", "function test_get_files_FAIL_1() {\n $path = \"/asdfasdf\";\n $source = get_all_files( $path );\n $this->assertEquals( 0, count( $source ) );\n }", "public function testReadDirFailsOnFile ()\n {\n $entry = $this->getMockBuilder('\\\\Hdfs\\\\EntryStatus')->disableOriginalConstructor()->getMock();\n $entry->expects($this->once())\n ->method('isDir')\n ->will($this->returnValue(false));\n\n $hdfs = $this->getMock('\\\\Hdfs\\\\Web', array('stat'));\n $hdfs->expects($this->once())\n ->method('stat')\n ->with(self::REMOTE_FILE)\n ->will($this->returnValue($entry));\n\n $hdfs->readDir(self::REMOTE_FILE);\n }", "public function testLoadResourceWithInvalidFile()\n {\n Crawler::create()\n ->loadResource('Fixures/css/foo.css');\n }", "function getFile($filename) {\n \tif( false == ($return = file_get_contents($filename))){\r\n return false;\r\n }else{\r\n return $return;\r\n }\r\n }", "function fileGet($URL) {\n\t$i = 0;\n\n\twhile ($i < 3) {\n\t\ttry {\n\t\t\t$httpOptions = array(\n\t\t\t\t'http' => array(\n\t\t\t\t\t'method' => \"GET\",\n\t\t\t\t\t'proxy' => 'tcp://192.168.1.50:9002',\n\t\t\t\t\t'header' => \"User-Agent:Mozilla/5.0\\r\\n\"\n\t\t\t\t)\n\t\t\t);\n\t\t\t$content = file_get_contents($URL, false, stream_context_create($httpOptions));\n\t\t\t// $content = file_get_contents ( $URL );\n\t\t\treturn $content;\n\t\t} catch (Exception $e) {\n\t\t\t$i++;\n\t\t\tsleep(3);\n\t\t}\n\t}\n\treturn false;\n}", "public function FetchFile()\n {\n if (self::IsFile()) {\n return file_get_contents($this->file);\n } else {\n return false;\n }\n }", "public function testReadMiss()\n {\n $this->setUpWithConfig();\n\n $key = 'any';\n\n $this->fileSystemMock->method('getFileWithPath')\n ->willReturn($this->fileMock);\n\n $this->fileMock->expects($this->once())\n ->method('Exists')\n ->willReturn(false);\n $this->fileMock->expects($this->never())\n ->method('getContent');\n\n $this->assertEquals(\n false,\n $this->testObj->Read($key)\n );\n }", "public function testFlysystemFileDownloadFindsValidScheme() {\n file_put_contents('vfs://module_file/file.txt', '1234');\n\n $return = flysystem_file_download('vfs://module_file/file.txt');\n\n $this->assertSame(2, count($return));\n $this->assertSame('txt/flysystem', $return['Content-Type']);\n $this->assertSame(4, $return['Content-Length']);\n }", "protected function _remoteFetch($url) {\n\t\tif($this -> _config['method'] == self::CURL) {\n\t\t\t$curl = curl_init();\n\t\t\t$options = array(\n\t\t\t\tCURLOPT_URL => $url,\n\t\t\t\tCURLOPT_RETURNTRANSFER => true,\n\t\t\t\tCURLOPT_HEADER => false,\n\t\t\t\tCURLOPT_SSL_VERIFYPEER => false\n\t\t\t);\n\t\t\tcurl_setopt_array($curl, $options);\n\t\t\t$response = curl_exec($curl);\n\t\t\t$status = curl_getinfo($curl,CURLINFO_HTTP_CODE);\n\t\t\tcurl_close($curl);\n\t\t\tif(!in_array($status,array(200,301,302))) {\n\t\t\t\tthrow new Exception('File was not found in ' . $url);\n\t\t\t}\t\t\t\n\t\t\treturn $response; \n\t\t} else {\n\t\t\treturn file_get_contents($url);\n\t\t}\n\t}", "public function testFileNotExist()\n {\n // Set the file to be parsed\n $file = 'employee.csv';\n\n // Parse the File\n $users = new Parser($file);\n }", "function fetch_remote_file ($url) {\n\t$fp = @fopen($url, 'r');\n\t\n\tif ( ! $fp ) {\n\t\treturn array(0, \"Unable to open remote file: $url\");\n\t}\n\t\n\twhile ( ! feof($fp) ) {\n\t\t$data .= fread( $fp, 1024 );\n\t}\n\tfclose($fp);\n\t\n\treturn array(1, $data);\n}", "public function testFlysystemFileDownloadIgnoresInvalidScheme() {\n $this->assertNull(flysystem_file_download('invalid://module_file/file.txt'));\n }", "public function testOpenReadFile()\n {\n // setup\n /** @var HDFSClient $hdfs */\n $hdfs = $this->hdfs;\n $hdfs->create($this->remoteFile, $this->localFile);\n $expectedResult = file_get_contents($this->localFile);\n\n // test\n $result = $hdfs->open($this->remoteFile);\n\n // cleanup\n $hdfs->delete($this->remoteFile);\n\n // asserts\n $this->assertEquals($result, $expectedResult, \"Local File and Remote File were not the same.\");\n }", "public function testSuccessDownloadFromUrl()\n {\n $localPath = $this->imageCachingManager->downloadFromUrl(self::IMAGE_URL, self::RECORD_ID);\n\n // Correct path should be returned\n $this->assertEquals('/var/www/project/public/cache/1/funny-games-1997-1S-KA-to-KP4.jpg', $localPath);\n // Error property should be empty\n $this->assertEquals(true, empty($this->imageCachingManager->getErrorMessage()));\n }", "public function testCannotOpenFile()\n {\n $reader = new JsonReader(null, 'vfs://tmp/foo.json');\n $reader->current();\n }" ]
[ "0.7069054", "0.6761468", "0.65476763", "0.65053535", "0.64640456", "0.64257824", "0.63317955", "0.6328389", "0.6252776", "0.6229527", "0.6224226", "0.6222008", "0.62189716", "0.61882615", "0.614238", "0.6127364", "0.6109264", "0.6103079", "0.60770416", "0.6048354", "0.6041193", "0.60357076", "0.6029629", "0.6028658", "0.6026445", "0.6024795", "0.60164136", "0.59808314", "0.59722483", "0.5966248" ]
0.7028613
1
Tests creating a file fetcher with a repo base URI.
public function testCreateFromUri(): void { $this->assertInstanceOf(GuzzleFileFetcher::class, GuzzleFileFetcher::createFromUri('https://example.com')); $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('Repo base URI must be HTTPS: http://example.com'); GuzzleFileFetcher::createFromUri('http://example.com'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testGetUrl() {\n\t\t$repo = $this->repo();\n\t\t$this->_testGetUrl($repo);\n\n\t\t// test same repo (private access)\n\t\t$cfg = $repo->getConfig();\n\t\t$cfg['options']['default_acl'] = 'private';\n\t\t$cls = get_class($repo);\n\t\t$repo_private = new $cls($cfg);\n\t\t$this->_testGetUrl($repo_private);\n\t}", "public function testRawFileUrl()\n {\n $this->assertEquals(\n 'https://raw.github.com/pdenis/monitoring/master/composer.json',\n $this->object->getRawFileUrl($this->repo->getSlug(), 'master', 'composer.json')\n );\n }", "public function testFetcherInstantiation(): void\n {\n $hasError = false;\n try {\n $fetcher = new Fetcher('literally-some-random-path');\n } catch (Exception $e) {\n $hasError = true;\n }\n $this->assertTrue($hasError);\n\n // if credentials file exist, it should instantiate without error\n $hasError = false;\n try {\n $fetcher = new Fetcher(__DIR__ . '/TestCredentials.json');\n } catch (Exception $e) {\n $hasError = true;\n }\n $this->assertFalse($hasError);\n\n /*\n not testing the batchGet call because it will be inconsistent across devices\n and sites, and it's not really testing the System Under Testing.\n */\n }", "public function testSuccessfulFetch(): void\n {\n $this->mockHandler->append(new Response(200, [], $this->testContent));\n\n $fetcher = new GuzzleFileFetcher($this->client);\n $this->assertSame($fetcher->fetchFile('test.json', 256), $this->testContent);\n }", "#[@test]\n public function fromResource() {\n $this->assertNull(create(new File(fopen($this->fileKnownToExist(), 'r')))->getURI());\n }", "public function testRemoteFile()\n {\n $url = 'https://www.google.com/';\n $crawler = new Crawler($url, 1);\n $crawler->traverse();\n $links = $crawler->getLinks();\n $this->assertEquals(get_class($crawler->getScrapClient()), \\Goutte\\Client::class);\n\n $this->assertEquals($links['https://www.google.com/']['status_code'], 200, $url.' shall be 200 ok');\n $this->assertGreaterThan(3, count($links));\n }", "public function testAddInventorySnapshotFileByURL()\n {\n }", "function _rac_repo_url($repo_url) {\n $repo_path = $repo_url;\n if (preg_match('|^file://|', $repo_url)) {\n $repo_path = substr($repo_url, 7);\n }\n if (!preg_match('|^/|', $repo_path)) {\n final_result_bad_request(\"Local repository path must be abosulte. Got '$repo_path'. Bailing out.\");\n }\n if (!is_dir($repo_path)) {\n final_result_bad_request(\"Local repository path '$repo_path' exists, but is not a directory. Bailing out.\");\n }\n\n return $repo_path;\n}", "public function testNonLocalHostUrl()\n {\n $config = new PactConfig();\n $config->setBaseUri(\"http://google.com\", 80, \"http\");\n\n // define local build\n $localBuild = new PactBuilder();\n $localBuild->setConfig($config)\n ->serviceConsumer(self::CONSUMER_NAME)\n ->hasPactWith(self::PROVIDER_NAME);\n\n\n // build the request\n $reqHeaders = array();\n $request = new ProviderServiceRequest(HttpVerb::GET, \"/test.php\", $reqHeaders);\n\n $resHeaders = array();\n $response = new ProviderServiceResponse('500', $resHeaders);\n\n // build up the expected results and appropriate responses\n $mockService = $localBuild->getMockService();\n $mockService->given(\"GET with Path\")\n ->uponReceiving(\"A GET request with a non-trivial path\")\n ->with($request)\n ->willRespondWith($response);\n\n // build system under test\n $host = $mockService->getHost();\n\n // test that we can overwrite the base url\n $hasException = false;\n try {\n $clientUnderTest = new MockApiConsumer();\n $clientUnderTest->setMockHost($host);\n $clientUnderTest->getWithPath(\"http://google.com\");\n } catch (PactFailureException $e) {\n $hasException = true;\n }\n $this->assertFalse($hasException, \"Even with a non-local host, this get with a path should verify the interactions and not throw an exception\");\n }", "public function testDownload()\n {\n $domain = 'pantheon.io';\n $url = \"http://$domain/somefile.tar.gz\";\n $target = 'some local path';\n\n $this->container->expects($this->at(0))\n ->method('get')\n ->with($this->equalTo(LocalMachineHelper::class))\n ->willReturn($this->local_machine_helper);\n $this->local_machine_helper->expects($this->once())\n ->method('getFilesystem')\n ->with()\n ->willReturn($this->filesystem);\n $this->filesystem->expects($this->once())\n ->method('exists')\n ->with($target)\n ->willReturn(false);\n $this->container->expects($this->at(1))\n ->method('get')\n ->with(\n $this->equalTo(Client::class),\n $this->equalTo([['base_uri' => $domain, RequestOptions::VERIFY => true,],])\n )\n ->willReturn($this->client);\n $this->client->expects($this->once())\n ->method('request')\n ->with(\n $this->equalTo('GET'),\n $this->equalTo($url),\n $this->equalTo(['sink' => $target,])\n );\n\n $out = $this->request->download($url, $target);\n $this->assertNull($out);\n }", "final function doClone()\r\n {\r\n $base = $this->_repo;\r\n $this->_mkdir($base);\r\n $this->initMod();\r\n /* fetch head file */\r\n $head = $this->getRemoteFile(\"HEAD\");\r\n /* get information file */\r\n $refs = $this->getRemoteFile(\"info/refs\");\r\n $info = $this->simpleParsing($refs, -1, \"\\t\", false);\r\n /* unpack the info and store it as local file */\r\n $rpacked = false;\r\n foreach ($info as $file => $id) {\r\n $parts = explode(\"/\", $file);\r\n if ($parts[1] == \"remotes\") {\r\n unset($info[$file]);\r\n continue;\r\n }\r\n try {\r\n $id = $this->getRemoteFile($file);\r\n $info[$file] = trim($id);\r\n } catch (Exception $e) {\r\n if (!$rpacked) {\r\n try {\r\n $this->getRemoteFile(\"packed-refs\");\r\n $rpacked = true;\r\n } catch (Exception $e) {\r\n $this->saveFile($file, $id);\r\n }\r\n }\r\n }\r\n }\r\n /* open actual repo */\r\n $this->setRepo($base);\r\n /* iterate over what we got and get all the commits */\r\n foreach ($info as $branch => $id) {\r\n try {\r\n $this->debug(\"Getting branch [$id] $branch\");\r\n $this->fetchCommit($id);\r\n } catch (Exception $e) {\r\n }\r\n }\r\n /* if it bare? */\r\n if (!$this->_bare) {\r\n $head = $this->simpleParsing($head, 1, ' ', false);\r\n $dir = substr($base, 0, strrpos($base, '/'));\r\n $this->checkout($dir, $info[key($head)]);\r\n }\r\n $config = array();\r\n $config[] = \"[core]\";\r\n $config[] = \"repositoryformatversion = 0\";\r\n $config[] = \"filemode = true\";\r\n $config[] = \"bare = \".($this->_bare ? \"true\" : \"false\");\r\n $config[] = \"logallrefupdates = true\";\r\n foreach ($info as $file => $id) {\r\n $parts = explode(\"/\", $file);\r\n if ($parts[1] != \"heads\") {\r\n continue;\r\n }\r\n $config[] = \"[branch \\\"{$parts[2]}\\\"]\";\r\n $config[] = \"merge = $file\";\r\n }\r\n file_put_contents(\"{$base}/config\", implode(\"\\n\", $config));\r\n return true;\r\n }", "public function testDownloadIfNew() {\n\t\t// Try to download the file (true if it did, false if not)\n\t\t$this->assertTrue(DataDownloader::downloadIfNew($this->fileToGrab, $this->filePath, $this->fileName, $this->fileExtension));\n\n\t\t// See what files are there\n\t\t$files = glob(\"$this->filePath$this->fileName*$this->fileExtension\");\n\n\t\t// See if they're there\n\t\t$this->assertNotEmpty($files);\n\t}", "public function testAddCartFileByURL()\n {\n }", "public function testVerifiedDownload(): void\n {\n $fixtureName = 'Simple';\n $updater = $this->getSystemInTest($fixtureName);\n\n $testFilePath = static::getFixturePath($fixtureName, 'server/targets/testtarget.txt', false);\n $testFileContents = file_get_contents($testFilePath);\n $this->assertSame($testFileContents, $updater->download('testtarget.txt')->getContents());\n\n // If the file fetcher returns a file stream, the updater should NOT try\n // to read the contents of the stream into memory.\n $stream = $this->prophesize('\\Psr\\Http\\Message\\StreamInterface');\n $stream->getMetadata('uri')->willReturn($testFilePath);\n $stream->getContents()->shouldNotBeCalled();\n $stream->rewind()->shouldNotBeCalled();\n $stream->getSize()->willReturn(strlen($testFileContents));\n $updater->download('testtarget.txt');\n\n // If the target isn't known, we should get an exception.\n try {\n $updater->download('void.txt');\n $this->fail('Expected a NotFoundException to be thrown, but it was not.');\n } catch (NotFoundException $e) {\n $this->assertSame('Target not found: void.txt', $e->getMessage());\n }\n\n $stream = Utils::streamFor('invalid data');\n $this->serverStorage->fileContents['testtarget.txt'] = $stream;\n try {\n $updater->download('testtarget.txt');\n $this->fail('Expected InvalidHashException to be thrown, but it was not.');\n } catch (InvalidHashException $e) {\n $this->assertSame(\"Invalid sha256 hash for testtarget.txt\", $e->getMessage());\n $this->assertSame($stream, $e->getStream());\n }\n }", "public function testFromGlobalsUrlBaseDefined(): void\n {\n Configure::write('App.base', 'basedir');\n $server = [\n 'DOCUMENT_ROOT' => '/cake/repo/branches/1.2.x.x/webroot',\n 'PHP_SELF' => '/index.php',\n 'REQUEST_URI' => '/posts/add',\n ];\n $res = ServerRequestFactory::fromGlobals($server);\n $this->assertSame('basedir', $res->getAttribute('base'));\n $this->assertSame('basedir/', $res->getAttribute('webroot'));\n $this->assertSame('/posts/add', $res->getUri()->getPath());\n }", "public function testAddLegacyLowstockContactFileByURL()\n {\n }", "public function testDownloadPathExists()\n {\n $domain = 'pantheon.io';\n $url = \"http://$domain/somefile.tar.gz\";\n $target = 'some local path';\n\n $this->container->expects($this->once())\n ->method('get')\n ->with($this->equalTo(LocalMachineHelper::class))\n ->willReturn($this->local_machine_helper);\n $this->local_machine_helper->expects($this->once())\n ->method('getFilesystem')\n ->with()\n ->willReturn($this->filesystem);\n $this->filesystem->expects($this->once())\n ->method('exists')\n ->with($target)\n ->willReturn(true);\n $this->client->expects($this->never())\n ->method('request');\n\n $this->setExpectedException(TerminusException::class, \"Target file $target already exists.\");\n\n $out = $this->request->download($url, $target);\n $this->assertNull($out);\n }", "public function testSetBaseUri()\n {\n $this->client->setBaseUri('http://foo.bar');\n\n $this->assertTrue($this->client->getBaseUri() == 'http://foo.bar');\n }", "public function testFormatterFileUri() {\n $entity_display = EntityViewDisplay::create([\n 'targetEntityType' => 'file',\n 'bundle' => 'file',\n ]);\n $entity_display->setComponent('uri', ['type' => 'file_uri']);\n\n $build = $entity_display->buildMultiple($this->files)[0]['uri'][0];\n $this->assertEquals('public://file.png', $build['#markup']);\n\n $entity_display->setComponent('uri', ['type' => 'file_uri', 'settings' => ['file_download_path' => TRUE]]);\n $build = $entity_display->buildMultiple($this->files)[0]['uri'][0];\n $this->assertEquals($this->fileUrlGenerator->generateString('public://file.png'), $build['#markup']);\n\n $entity_display->setComponent('uri', ['type' => 'file_uri', 'settings' => ['file_download_path' => TRUE, 'link_to_file' => TRUE]]);\n $build = $entity_display->buildMultiple($this->files)[0]['uri'][0];\n $this->assertEquals($this->fileUrlGenerator->generateString('public://file.png'), $build['#title']);\n $this->assertEquals($this->fileUrlGenerator->generate('public://file.png'), $build['#url']);\n }", "public function fetch($basepath);", "abstract function getGistFileContents($url);", "function getData_fromRepository($params=array()) { //url, repo, id, taxon, filename, data_type\n\n // get params\n $url = $params['url'];\n $datatype = (isset($params['data_type'])&& $params['data_type']? $params['data_type']:\"\");\n $filetype = (isset($params['file_type'])&& $params['file_type']? $params['file_type']:\"\");\n $descrip = (isset($params['description'])&& $params['description']? $params['description']:\"\");\n \n //validate URL via HEAD\n/*\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n curl_setopt($ch, CURLOPT_HEADER, TRUE);\n curl_setopt($ch, CURLOPT_TIMEOUT, 6);\n //curl_setopt($ch, CURLOPT_NOBODY, TRUE); // forces method HEAD. Does not work with redirects\n $curl_data = curl_exec($ch);\n if (!$curl_data){\n $_SESSION['errorData']['Error'][] = \"Resource URL ('$url') cannot be verified. HEAD not accepted\";\n redirect($_SERVER['HTTP_REFERER']);\n }\n*/\n $url_data = process_URL($url);\n\n //status\n //$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n $status = $url_data['status'];\n //$url_effective = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);\n $url_effective = $url_data['effective_url'];\n\n if ($status != 200 && !preg_match('/^3/',$status) ){\n $_SESSION['errorData']['Error'][] = \"Resource URL ('$url') is not valid or unaccessible. Status: $status\";\n redirect($_SERVER['HTTP_REFERER']);\n }\n //filename\n $filename = $url_data['filename'];\n if (! $filename){\n $_SESSION['errorData']['Error'][] = \"Resource URL ('$url') is not pointing to a valid filename\";\n redirect($_SERVER['HTTP_REFERER']);\n }\n\n //size\n //$size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);\n $size = (int)$url_data['size'];\n $usedDisk = (int)getUsedDiskSpace();\n $diskLimit = (int)$_SESSION['User']['diskQuota'];\n if ($size == 0 ) {\n $_SESSION['errorData']['Error'][] = \"Resource URL ('$url') is pointing to an empty resource (size = 0)\";\n redirect($_SERVER['HTTP_REFERER']);\n\n }\n if ($size > ($diskLimit-$usedDisk) ) {\n $_SESSION['errorData']['Error'][] = \"Cannot import file. There will be not enough space left in the workspace (size = $size)\";\n redirect($_SERVER['HTTP_REFERER']);\n }\n //curl_close($ch);\n\n // setting repository directory\n\n $dataDirPath = getAttr_fromGSFileId($_SESSION['User']['dataDir'],\"path\");\n $wd = $dataDirPath.\"/repository\";\n $wdP = $GLOBALS['dataDir'].\"/\".$wd;\n $wdId = getGSFileId_fromPath($wd);\n\n if ( $wdId == \"0\"){\n\t//creating repository directory. Old users dont have it\n\t$wdId = createGSDirBNS($wd,1);\n\t$_SESSION['errorData']['Info'][] = \"Creating repository directory: $wd ($wdId)\";\n\n\tif ($wdId == \"0\" ){\n $_SESSION['errorData']['Internal error'][] = \"Cannot create repository directory in $dataDirPath\";\n redirect($_SERVER['HTTP_REFERER']);\n\t}\n\t$r = addMetadataBNS($wdId,Array(\"expiration\" => -1,\n\t\t\t\t \"description\"=> \"Remote personal data\"));\n\tif ($r == \"0\"){\n $_SESSION['errorData']['Internal error'][] = \"Cannot set 'repository' directory $wd\";\n redirect($_SERVER['HTTP_REFERER']);\n\t}\n\tif (!is_dir($wdP))\n\t\tmkdir($wdP, 0775);\n }\n if ($wdId == \"0\" || !is_dir($wdP)){\n\t\t$_SESSION['errorData']['Error'][]=\"Target server directory '$wd' is not a directory. Your user account is corrupted. Please, report to <a href=\\\"mailto:[email protected]\\\">[email protected]</a>\";\n redirect($_SERVER['HTTP_REFERER']);\n }\n \n // Check file already registered\n $fnP = \"$wdP/$filename\";\n $fn = \"$wd/$filename\";\n $fnId = getGSFileId_fromPath($fn);\n\n if ($fnId){\n // file already here\n $_SESSION['errorData']['Error'][]=\"Resource file ('$url') is already available in the workspace: $fnP\";\n\n redirect(\"../getdata/editFile.php?fn[]=$fnId\");\n\n }else{\n //asyncronous download file (internal tool wget)\n \n //FIXME START - This is a temporal fix. In future, files should not be downloaded, only registered\n\n //output_dir will be where fn is expeted to be created: repository\n $output_dir = $wdP;\n \n // working_dir will be set in user temporal dir. Checking it\n // TODO Or NO! maybe we decide to run directly on uploads/\n $dirTmp = $GLOBALS['dataDir'].\"/\".$dataDirPath.\"/\".$GLOBALS['tmpUser_dir'];\n if (! is_dir($dirTmp)){\n \t if(!mkdir($dirTmp, 0775, true)) {\n \t\t$_SESSION['errorData']['error'][]=\"Cannot create temporal file $dirTmp . Please, try it later.\";\n \t\t$resp['state']=0;\n\t \t#break;\n \t }\n }\n\n // choosing interanl tool \n $toolId = \"wget\";\t\n\n // setting tool\tinputs\n $toolInputs= array();\n\n // setting tool\targuments. Tool is responsible to create outputs in the output_dir\n $toolArgs = array(\n \"url\" => $url, \n \"output\" => $fnP); \n\n // setting tool outputs. Metadata will be saved in DB during tool output_file registration\n if (!$descrip){\n\t\t$descrip=\"Remote file extracted from <a target='_blank' href=\\\"$url\\\">$url</a>\";\n\t}\n if (!$filetype){\n\t\tlist($fileExtension,$compressed,$fileBaseName) = getFileExtension($fnP); \n\t $filetypes = getFileTypeFromExtension($fileExtension);\n \t$filetype =(isset(array_keys($filetypes)[0])?array_keys($filetypes)[0]:\"\");\n\t}\n\n if ($filetype != \"\" && $datatype != \"\"){\n $validated = true ; // Can lead to problems\n }else{\n $validated = false;\n }\n\n $fileOut=array(\n\t\t \"name\" => \"file\",\n\t\t \"type\" => \"file\",\n \t\t \"file_path\" => $fnP,\n \t \t \"data_type\" => $datatype,\n \t \t \"file_type\" => $filetype,\n \"sources\" => [0],\n\t \"source_url\" => $url,\n \t \"meta_data\" => array(\n\t \"validated\" => $validated,\n \t \"compressed\" => $compressed,\n\t \t \"description\" => $descrip,\n\t\t\t )\n\t);\n\tif (isset($params['oeb_dataset_id'])){ $fileOut['meta_data'][\"oeb_dataset_id\"] = $params['oeb_dataset_id'];}\n\tif (isset($params['oeb_community_ids'])){ $fileOut['meta_data'][\"oeb_community_ids\"] = $params['oeb_community_ids'];}\n\n $toolOuts = Array (\"output_files\" => Array($fileOut));\n \n // setting logName\n $logName = basename($fnP). \".log\";\n \n //calling internal tool\n $pid = launchToolInternal($toolId,$toolInputs,$toolArgs,$toolOuts,$output_dir,$logName);\n\n if ($pid == 0){\n $_SESSION['errorData']['Error'][]=\"Resource file '\".basename($fnP).\"' cannot be imported. Error occurred while preparing the job 'Get remote file'\";\n redirect($_SERVER['HTTP_REFERER']);\n }else{\n $_SESSION['errorData']['Info'][] =\"Remote file '\".basename($fnP).\"' imported into the 'repository' folder below. Please, edit its metadata once the job has finished\";\n\t redirect($GLOBALS['BASEURL'].\"workspace/\");\n }\n //FIXME END\n \n \n /*\n // save File into DMP\n $insertData=array(\n \t'owner' => $_SESSION['User']['id'],\n \t'size' => $size,\n \t'mtime' => new MongoDB\\BSON\\UTCDateTime(strtotime(\"now\")*1000)\n );\n $descrip=(isset($params['repo'])?\"Remote file extracted from \".$params['repo']:\"Remote file\");\n $metaData=array(\n 'validated' => false,\n 'description' => $descrip\n );\n \n $fnId = uploadGSFileBNS_fromURL($params['url'],$wd, $insertData,$metaData,0);\n \n \n if ($fnId == \"0\"){\n $_SESSION['errorData']['Error']=\"Error occurred while registering the repository file\";\n \tdie(\"ERROR: Error occurred while registering the repository file.\");\n }\n */\n }\n}", "public function testCreateFileRepositoryCommand()\n {\n $tmpDir = $this->registerTemporaryDirectory(__DIR__.DIRECTORY_SEPARATOR.'Fixture'.DIRECTORY_SEPARATOR.'.repo');\n\n /** @var Application $application */\n $application = Kernel::create(Application::class);\n $application->add(Kernel::create(FileCommmand::class));\n $command = $application->find('create:repository:file');\n $commandTester = Kernel::create(CommandTester::class, [$command]);\n $commandTester->execute(array(\n 'command' => $command->getName(),\n 'root' => __DIR__.DIRECTORY_SEPARATOR.'Fixture',\n ));\n $output = $commandTester->getDisplay();\n $this->assertEquals(0, strncmp($output, 'Repository successfully created at', 18));\n $this->assertFileExists($tmpDir.DIRECTORY_SEPARATOR.'size.txt');\n }", "public function testDownloader()\n {\n $composer = new Composer();\n $composer->setConfig(new Config());\n $io = new NullIO();\n $plugin = Stub::makeEmpty(PluginInterface::class);\n\n $downloader = new ComposerDownloader($composer, $io, $plugin);\n\n $patch = new Patch();\n $patch->package = \"placeholder\";\n $patch->description = \"test patch\";\n $patch->url = \"https://patch-diff.githubusercontent.com/raw/cweagans/composer-patches-testrepo/pull/1.patch\";\n\n $downloader->download($patch);\n\n $sha = '0ec56d93aed447775aa70e55b5530f401cb3a59facd8ce20301c1d007461f1bf';\n $this->assertNotEmpty($patch->localPath);\n $this->assertEquals($sha, $patch->sha256);\n\n $path = $patch->localPath;\n\n // Downloading the same patch again shouldn't throw an exception or\n // anything, but it won't re-download. Should be the same path.\n $downloader->download($patch);\n $this->assertEquals($path, $patch->localPath);\n $this->assertEquals($sha, $patch->sha256);\n\n // If the patch sha256 is set to something that doesn't match the file,\n // an exception should be thrown. (clearing localPath to force re-download\n // and re-check of sha256.\n $patch->localPath = '';\n $patch->sha256 = 'an incorrect hash';\n $this->expectException(HashMismatchException::class);\n $downloader->download($patch);\n }", "public function testCreation() {\n self::$manager->init();\n $file = self::DIR . self::FILE;\n $this->assertTrue(file_exists($file));\n }", "public function testGetImageUri()\n {\n $oGen = new oxDynImgGenerator();\n $this->assertEquals( isset( $_SERVER[\"REQUEST_URI\"] ) ? $_SERVER[\"REQUEST_URI\"] : \"\", $oGen->UNITgetImageUri() );\n }", "abstract protected function fetchFromFile();", "public function testCreate()\n {\n $uri = (new UriFactory())->create(\n 'http://user:[email protected]:1111/path/123?q=abc#test'\n );\n\n $this->assertInstanceOf(Uri::class, $uri);\n $this->assertEquals('http', $uri->getScheme());\n $this->assertEquals('user:password', $uri->getUserInfo());\n $this->assertEquals('test.com', $uri->getHost());\n $this->assertEquals(1111, $uri->getPort());\n $this->assertEquals('/path/123', $uri->getPath());\n $this->assertEquals('q=abc', $uri->getQuery());\n $this->assertEquals('test', $uri->getFragment());\n }", "public function testCanSetPath()\n {\n $reader= new GitHashReader(new Filesystem(), __DIR__ . '/stubs', 'git-mock');\n\n $this->assertSame(__DIR__ . '/stubs/git-mock', $reader->getPath());\n }", "public function testLocalFile()\n {\n $composer = new Composer();\n $composer->setConfig(new Config());\n $io = new NullIO();\n $plugin = Stub::makeEmpty(PluginInterface::class);\n\n $downloader = new ComposerDownloader($composer, $io, $plugin);\n\n $patch = new Patch();\n $patch->package = \"placeholder\";\n $patch->description = \"test patch\";\n $patch->url = codecept_data_dir('localfile.patch');\n\n $downloader->download($patch);\n\n $sha = '0ec56d93aed447775aa70e55b5530f401cb3a59facd8ce20301c1d007461f1bf';\n $this->assertNotEmpty($patch->localPath);\n $this->assertEquals($sha, $patch->sha256);\n }" ]
[ "0.64277", "0.63555706", "0.61939186", "0.6055069", "0.5828776", "0.5807625", "0.57922924", "0.560783", "0.5594065", "0.549786", "0.5483805", "0.54559356", "0.5404508", "0.54037774", "0.5367203", "0.5346002", "0.5342912", "0.53388304", "0.5328984", "0.53091323", "0.5278864", "0.5274382", "0.5251508", "0.52412486", "0.5235996", "0.5231944", "0.52252007", "0.5169037", "0.5164028", "0.5161245" ]
0.64696527
0
Converts option object to the array representation
public function _convertToArray($option) { $commonArgs = array( 'is_delete', 'previous_type', 'previous_group', 'title', 'type', 'is_require', 'sort_order', 'values', ); $priceArgs = array( 'price_type', 'price', 'sku', ); $txtArgs = array('max_characters'); $fileArgs = array( 'file_extension', 'image_size_x', 'image_size_y' ); $type = $option->getType(); switch ($type) { case 'file': $optionArgs = array_merge($commonArgs, $priceArgs, $fileArgs); break; case 'field': case 'area': $optionArgs = array_merge($commonArgs, $priceArgs, $txtArgs); break; case 'date': case 'date_time': case 'time': $optionArgs = array_merge($commonArgs, $priceArgs); break; default : $optionArgs = $commonArgs; } $optionAsArray = $option->toArray($optionArgs); if (in_array($type, array('drop_down', 'radio', 'checkbox', 'multiple'))) { $valueArgs = array_merge(array('is_delete', 'title', 'sort_order'), $priceArgs); $optionAsArray['values'] = []; foreach ($option->getValues() as $value) { $optionAsArray['values'][] = $value->toArray($valueArgs); } } return $optionAsArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toOptionArray()\n {\n $result = [];\n foreach ($this->getOptions() as $value => $label) {\n $result[] = [\n 'value' => $value,\n 'label' => $label,\n ];\n }\n\n return $result;\n }", "public function toOptionArray(){\n\n }", "public function toOptionArray()\n {\n $array = [];\n foreach ($this->getOptions() as $key => $val) {\n $array[] = [\n 'value' => $key,\n 'label' => $val\n ];\n }\n\n return $array;\n }", "public function toOptionArray()\n {\n return $this->getAllOptions();\n }", "public function toArray()\n {\n return $this->_options;\n }", "public function toArray() : array\n {\n return $this->options;\n }", "public function toOptionArray()\n {\n return $this->getOptions();\n }", "public function toOptionArray(): array\n {\n if ($this->options !== null) {\n return $this->options;\n }\n\n $options = [];\n $thisOptions = $this->getAllOptions();\n\n foreach ($thisOptions as $key => $value) {\n $options[] = [\n 'label' => $value,\n 'value' => $key,\n ];\n }\n $this->options = $options;\n\n return $this->options;\n }", "public function toOptionArray()\n {\n $options = [];\n foreach ($this->toArray() as $value => $label) {\n $options[] = [\n 'value' => $value,\n 'label' => $label\n ];\n }\n\n return $options;\n }", "public function toOptionArray()\n {\n $options = array();\n\n if (false === $this->getDataHelper()->isEnabled()) {\n return $options;\n }\n\n try {\n $data = $this->getData();\n\n // No data? return an empty options array\n if ($data == NULL) {\n return $options;\n }\n\n // TODO: API sends back an object if there's only one result. We'll need to\n // handle this case otherwise we'll error out trying to loop over the object.\n else if (!is_array($data)) {\n $data = [$data];\n }\n\n foreach ($data as $option) {\n $value = $option->{sprintf('get%s', $this->getValueProperty())}();\n $label = $option->{sprintf('get%s', $this->getLabelProperty())}();\n\n $options[$value] = $label;\n }\n } catch (Exception $e) {\n Mage::log($e->getMessage(), null, 'communicator.log');\n }\n\n return $options;\n }", "public function toArray()\n {\n $optionArray = [];\n foreach ($this->toOptionArray() as $option) {\n $optionArray[$option['value']] = $option['label'];\n }\n return $optionArray;\n }", "public function toOptionArray()\n {\n return [];\n }", "public function toOptionArray()\n {\n return [\n ['value' => '1', 'label' => 'v1'],\n ];\n }", "public function toArray()\n {\n $_tmpOptions = $this->toOptionArray();\n $_options = [];\n foreach ($_tmpOptions as $option) {\n $_options[$option['value']] = $option['label'];\n }\n return $_options;\n }", "public function toOptionArray()\n {\n return [\n ['value' => 1, 'label' => __('1')],\n ['value' => 2, 'label' => __('2')],\n ['value' => 3, 'label' => __('3')],\n ['value' => 4, 'label' => __('4')],\n ];\n }", "public function toArray()\n {\n $options = array(\n 'confidence_interval' => $this->getConfidenceInterval(),\n 'is_most_conclusive' => $this->getIsMostConclusive(),\n 'is_significant' => $this->getIsSignificant(),\n 'significance' => $this->getSignificance(),\n 'value' => $this->getValue(), \n 'visitors_remaining' => $this->getVisitorsRemaining(),\n 'lift_status' => $this->getLiftStatus(),\n );\n \n // Remove options with empty values\n $cleanedOptions = array();\n foreach ($options as $name=>$value) {\n if ($value!==null)\n $cleanedOptions[$name] = $value;\n }\n \n return $cleanedOptions;\n }", "protected function formatOptionData()\n {\n $data = [];\n foreach ($this->optionParams as $property) {\n if (null != $this->{$property}) {\n $data[$property] = $this->{$property};\n }\n }\n\n return $data;\n }", "public function toArray()\n {\n return $this->_getOptions();\n }", "public function getOptions(): array\n {\n return (array) json_decode(json_encode($this->options));\n }", "public function toOptionArray()\n {\n return array(\n array('value' => 'normal', 'label' => Mage::helper('oyst_oneclick')->__('Normal')),\n array('value' => 'inversed', 'label' => Mage::helper('oyst_oneclick')->__('Inversed')),\n );\n }", "public function toOptionArray()\n {\n $data = [\n [\n 'value' => Rewrite::ENTITY_TYPE_PRODUCT,\n 'label' => __('Product')\n ]\n ];\n\n return $data;\n }", "public function toArray()\n {\n $optionArray = $this->toOptionArray();\n $labels = array_column($optionArray, 'label');\n $values = array_column($optionArray, 'value');\n\n return array_combine($values, $labels);\n }", "public function toOptionArray(): array\n {\n return [\n ['value' => self::SANDBOX, 'label' => __('Sandbox')],\n ['value' => self::PRODUCTION, 'label' => __('Production')]\n ];\n }", "public function toArray()\n {\n $options = [];\n foreach ($this->_getOptions() as $option) {\n $options[ $option['value'] ] = $option['label'];\n }\n\n return $options;\n }", "public function toOptionArray()\n {\n\n $product = Mage::getModel('catalog/product');\n $attributes = $attributes = Mage::getResourceModel('eav/entity_attribute_collection')\n ->setEntityTypeFilter($product->getResource()->getTypeId());\n\n $attributes_array = array();\n $attributes_array[] = array(\"value\" => '', 'label' => '--');\n foreach ($attributes as $attr) {\n $attributes_array[] = array(\"value\" => $attr['attribute_code'], 'label' => $attr['frontend_label']);\n }\n return $attributes_array;\n\n }", "public static function optionToArray(InputOption $opt): iterable\n {\n $return = [\n 'name' => '--' . $opt->getName(),\n 'accept_value' => $opt->acceptValue(),\n 'is_value_required' => $opt->isValueRequired(),\n 'shortcut' => $opt->getShortcut(),\n 'description' => $opt->getDescription(),\n ];\n if ($opt->getDefault()) {\n $return['defaults'] = (array)$opt->getDefault();\n }\n return $return;\n }", "public function toOptionArray() {\n \t$options = parent::toOptionArray();\n \t$options[0] = array(\n \t\t'value' => 'manual',\n \t\t'label' => __('Manual capture only'),\n \t);\n// \t$options[1] = array(\n// \t\t'value' => 'state',\n// \t\t'label' => __('On order state change'),\n// \t);\n $options[2] = array(\n \t\t'value' => 'shipment',\n \t\t'label' => __('On order shipment'),\n \t);\n \treturn $options;\n }", "public function toArray()\n {\n $options = [];\n\n foreach ($this->toOptionArray() as $option) {\n $options[$option['value']] = $option['label'];\n }\n\n return $options;\n }", "public function toOptionArray()\n {\n // get available payment methods\n $arr = [];\n foreach ($this->paymentHelper->getPaymentMethodList() as $code => $title) {\n if (!empty($code) && !empty($title)) {\n $arr[] = ['value' => $code, 'label' => __($title) . \" [$code]\"];\n }\n }\n return $arr;\n }", "public function toOptionArray()\n {\n $result = array();\n foreach ($this as $item) {\n $appId = $item->getData('application_id');\n $category = $item->getData('category');\n $path = $item->getData('path');\n $value = $item->getData('value');\n\n if ($this->_applicationFilter) {\n $result[$category][$path] = $value;\n } else {\n $result[$appId][$category][$path] = $value;\n }\n }\n return $result;\n }" ]
[ "0.76372385", "0.7572549", "0.74690735", "0.7459502", "0.7428769", "0.7416435", "0.7416274", "0.73187804", "0.71730244", "0.71629703", "0.71423763", "0.7131195", "0.7060503", "0.7035423", "0.7022298", "0.6998959", "0.69973093", "0.6989548", "0.69490784", "0.6929616", "0.69268703", "0.69105256", "0.6910239", "0.6898976", "0.6897232", "0.68672025", "0.686592", "0.68459076", "0.6827368", "0.68172985" ]
0.7742788
0
open the server connection the imap_open function parameters will need to be changed for the particular server these are laid out to connect to a Dreamhost IMAP server
function connect() { $this->conn = imap_open('{'.$this->server.'/notls}', $this->user, $this->pass); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function connect()\n {\n $this->conn = imap_open('{'.$this->server.'/notls}', $this->user, $this->pass);\n echo '... ';\n }", "public function imap_connect()\n {\n if (!$this->imap)\n $this->imap_init();\n \n if ($_SESSION['imap_host'] && !$this->imap->conn->connected()) {\n if (!$this->imap->connect($_SESSION['imap_host'], $_SESSION['username'], $this->decrypt($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl'])) {\n if ($this->output)\n $this->output->show_message($this->imap->error_code == -1 ? 'imaperror' : 'sessionerror', 'error');\n }\n else {\n $this->set_imap_prop();\n return $this->imap->conn;\n }\n }\n\n return false;\n }", "public function connect($params = array()){\n \t$this->server = $params['server'];\n \t$this->username = $params['username'];\n \t$this->password = $params['password'];\n $this->marubox = @imap_open($this->server,$this->username,$this->password); //开启邮箱 \n return $this->marubox; \n }", "public function open(){\n\n\t\t//check for mail\n\t\t$host = \"{\".$this->host.\":\".$this->port.\"/\".$this->protocol.\"/notls}INBOX\";\n\n\t\t//open the mail box for reading\n\t\t$this->inbox = imap_open($host, $this->address, $this->pass);\n\n\t\tif (!$this->inbox){\n\n\t\t\t$this->connected =0;\n\t\t} else {\n\n\t\t\t$this->connected =1;\n\t\t}\n\t\t\n\t\treturn $this->connected;\n\n\t}", "function connect($host, $port, $login, $pass){\n\n $this->IMAP_host = $host;\n $this->IMAP_login = $login;\n \n $this->link = imap_open(\"{\". $host . $port.\"}INBOX\", $login, $pass);\n if($this->link) {\n $this->status = 'Connected';\n } else {\n $this->error[] = imap_last_error();\n $this->status = 'Not connected';\n }\n }", "function open() {\n\t\t$this->smtp = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);\n\n\t\tif (!$this->smtp)\n\t\t\t$this->log(\"failed to open socket [$this->host:$this->port] $errno $errstr\");\n\t\telse\n\t\t\t$this->log('socket opened successfully');\n\n\t\t// read what should be a server id string\n\t\t$this->read();\n\t\t$this->write('HELO');\n\t\t$this->read();\n\n\t\tif ($this->auth_type)\n\t\t\t$this->performAuth();\n\t}", "public function open ($password = '')\n {\n // open() tries a series of connection options from more secure to\n // least-secure. If a port was specified, then only that port is tried.\n if ( ! static::$_globals & MUST_GO_FASTER ) {\n // Test the network before continuing.\n $network = \\Asinius\\Network::test();\n if ( $network['status'] == 'offline' ) {\n throw new \\RuntimeException(\"Can't connect to remote imap server; the network is currently offline\");\n }\n }\n if ( $password == '' ) {\n $password = $this->password;\n }\n // List of available connection configurations, ordered from most\n // secure to least.\n $configurations = [\n ['imap', 'ssl', 'secure', 'validate-cert'],\n ['imap', 'ssl', 'secure', 'novalidate-cert'],\n ['imap', 'tls', 'secure'],\n ['imap', 'tls', 'secure', 'novalidate-cert'],\n ['imap'],\n ];\n foreach ($this->port as $port) {\n $disabled_options = [];\n foreach ($configurations as $configuration) {\n if ( $port == 143 && in_array('ssl', $configuration) ) {\n // Assume no SSL support on 143.\n continue;\n }\n if ( ! empty(array_intersect($disabled_options, $configuration) ) ) {\n // If any of the available options for this port have been\n // disabled by an error from a previous attempt, skip it.\n continue;\n }\n $this->_configuration = sprintf('{%s:%s/%s}', $this->hostname, $port, implode('/', $configuration));\n $saved = error_reporting(0);\n $this->_imap_connection = @imap_open($this->_configuration, $this->username, $password, OP_HALFOPEN, 1);\n error_reporting($saved);\n // Errors and alerts should be cleared here before continuing.\n $errors = imap_errors();\n $alerts = imap_alerts();\n if ( $this->_imap_connection !== false ) {\n // Successful connection. Save the port value that worked.\n $this->port = $port;\n break 2;\n }\n else {\n // imap_errors() and imap_alerts() can each return false\n // if no errors are available, instead of an empty array.\n $messages = array_merge($errors === false ? [] : $errors, $alerts === false ? [] : $alerts);\n foreach ($messages as $message) {\n switch (1) {\n case (preg_match('/: Connection refused$/', $message)):\n // This port is no good, so skip it.\n continue 4;\n case (preg_match('/: SSL negotiation failed$/i', $message)):\n // Assume SSL doesn't work here?\n $disabled_options[] = 'ssl';\n continue 2;\n case (preg_match('/^Unable to negotiate TLS with this server$/i', $message)):\n // Assume TLS doesn't work here.\n $disabled_options[] = 'tls';\n continue 2;\n case (preg_match('/Authentication failed/', $message)):\n // A connection was negotiated but the username or password are wrong.\n // Stop trying; avoid tripping any security systems on the remote end.\n // TODO: An appropriate Datastream error needs to be stored here.\n return;\n }\n }\n }\n }\n }\n // Don't keep the password in memory past this point.\n $this->password = '';\n $this->_lock_property('hostname');\n $this->_lock_property('username');\n $this->_lock_property('password');\n $this->_lock_property('mailbox');\n $this->_lock_property('port');\n if ( $this->_imap_connection === false ) {\n $this->_configuration = '';\n }\n $this->_status = 1;\n }", "public function openMailbox()\n {\n // before starting the processing, let's check the delete flag and do global deletes if true\n if (trim($this->deleteMsgDate) != '') {\n echo 'processing global delete based on date of ' . $this->deleteMsgDate . '<br />';\n $this->globalDelete();\n }\n\n // disable move operations if server is Gmail ... Gmail does not support mailbox creation\n if (false !== stripos($this->mailhost, 'gmail')) {\n $this->moveSoft = false;\n $this->moveHard = false;\n }\n\n $port = $this->port . '/' . $this->service . '/' . $this->serviceOption;\n\n set_time_limit(6000);\n\n if (!$this->testMode) {\n $this->mailboxLink = imap_open('{' . $this->mailhost . ':' . $port . '}' . $this->boxname, $this->mailboxUserName, $this->mailboxPassword, CL_EXPUNGE | ($this->testMode ? OP_READONLY : 0));\n } else {\n $this->mailboxLink = imap_open('{' . $this->mailhost . ':' . $port . '}' . $this->boxname, $this->mailboxUserName, $this->mailboxPassword, ($this->testMode ? OP_READONLY : 0));\n }\n\n if (!$this->mailboxLink) {\n $this->errorMessage = 'Cannot create ' . $this->service . ' connection to ' . $this->mailhost . $this->bmhNewLine . 'Error MSG: ' . imap_last_error();\n $this->output();\n\n return false;\n }\n\n $this->output('Connected to: ' . $this->mailhost . ' (' . $this->mailboxUserName . ')');\n\n return true;\n }", "public function imap_init($connect = false)\n {\n // already initialized\n if (is_object($this->imap))\n return;\n \n $this->imap = new crystal_imap($this->db);\n $this->imap->debug_level = $this->config->get('debug_level');\n $this->imap->skip_deleted = $this->config->get('skip_deleted');\n\n // enable caching of imap data\n if ($this->config->get('enable_caching')) {\n $this->imap->set_caching(true);\n }\n\n // set pagesize from config\n $this->imap->set_pagesize($this->config->get('pagesize', 50));\n \n // Setting root and delimiter before establishing the connection\n // can save time detecting them using NAMESPACE and LIST \n $options = array(\n 'auth_method' => $this->config->get('imap_auth_type', 'check'),\n 'delimiter' => isset($_SESSION['imap_delimiter']) ? $_SESSION['imap_delimiter'] : $this->config->get('imap_delimiter'),\n 'rootdir' => isset($_SESSION['imap_root']) ? $_SESSION['imap_root'] : $this->config->get('imap_root'),\n 'debug_mode' => (bool) $this->config->get('imap_debug', 0),\n 'force_caps' => (bool) $this->config->get('imap_force_caps'),\n );\n\n $this->imap->set_options($options);\n \n // set global object for backward compatibility\n $GLOBALS['IMAP'] = $this->imap;\n\n $hook = $this->plugins->exec_hook('imap_init', array('fetch_headers' => $this->imap->fetch_add_headers));\n if ($hook['fetch_headers'])\n $this->imap->fetch_add_headers = $hook['fetch_headers'];\n \n // support this parameter for backward compatibility but log warning\n if ($connect) {\n $this->imap_connect();\n raise_error(array('code' => 800, 'type' => 'imap', 'file' => __FILE__,\n 'message' => \"crystal::imap_init(true) is deprecated, use crystal::imap_connect() instead\"), true, false);\n }\n }", "function connect($host, $user, $pass, $port=143, $use_ssl=null)\n {\n // check for Open-SSL support in PHP build\n if ($use_ssl && extension_loaded('openssl'))\n $this->options['ssl_mode'] = $use_ssl == 'imaps' ? 'ssl' : $use_ssl;\n else if ($use_ssl) {\n raise_error(array('code' => 403, 'type' => 'imap',\n 'file' => __FILE__, 'line' => __LINE__,\n 'message' => \"OpenSSL not available\"), true, false);\n $port = 143;\n }\n\n $this->options['port'] = $port;\n\n $attempt = 0;\n do {\n $data = cmail::get_instance()->plugins->exec_hook('imap_connect',\n array('host' => $host, 'user' => $user, 'attempt' => ++$attempt));\n \n if (!empty($data['pass']))\n $pass = $data['pass'];\n\n $this->conn->connect($data['host'], $data['user'], $pass, $this->options);\n } while(!$this->conn->connected() && $data['retry']);\n\n $this->host = $data['host'];\n $this->user = $data['user'];\n $this->pass = $pass;\n $this->port = $port;\n $this->ssl = $use_ssl;\n\n // print trace messages\n if ($this->conn->connected()) {\n if ($this->conn->message && ($this->debug_level & 8)) {\n console($this->conn->message);\n }\n\n // get server properties\n if (!empty($this->conn->rootdir))\n $this->set_rootdir($this->conn->rootdir);\n if (empty($this->delimiter))\n\t $this->get_hierarchy_delimiter();\n\n return true;\n }\n // write error log\n else if ($this->conn->error) {\n $this->error_code = $this->conn->errornum;\n raise_error(array('code' => 403, 'type' => 'imap',\n 'file' => __FILE__, 'line' => __LINE__,\n 'message' => $this->conn->error), true, false);\n }\n\n return false;\n }", "protected function open_mailbox_connection( $connection_options ) {\n $options = get_option( 'bbt_post_by_email_options' );\n if ( 'POP3' == $options['mailserver_protocol'] ) {\n $this->protocol = 'POP3';\n $connection = new Horde_Imap_Client_Socket_Pop3( $connection_options );\n } else { // IMAP\n $this->protocol = 'IMAP';\n $connection = new Horde_Imap_Client_Socket( $connection_options );\n }\n $connection->_setInit( 'authmethod', 'USER' );\n\n try {\n $connection->login();\n }\n catch( Horde_Imap_Client_Exception $e ) {\n //$this->save_error_message( esc_html__( 'An error occurred: ', 'BigBangThemesFramework') . $e->getMessage() );\n return false;\n }\n\n return $connection;\n }", "function connect ($server, $port = 110) {\n // port defaults to 110. Returns true on success, false on fail\n\n // If MAILSERVER is set, override $server with its value.\n\n if (!isset($port) || !$port) {$port = 110;}\n if(!empty($this->MAILSERVER))\n $server = $this->MAILSERVER;\n\n if(empty($server)){\n $this->ERROR = \"POP3 connect: \" . _(\"No server specified\");\n unset($this->FP);\n return false;\n }\n\n $fp = @fsockopen(\"$server\", $port, $errno, $errstr);\n\n if(!$fp) {\n $this->ERROR = \"POP3 connect: \" . _(\"Error \") . \"[$errno] [$errstr]\";\n unset($this->FP);\n return false;\n }\n\n socket_set_blocking($fp,-1);\n $this->update_timer();\n $reply = fgets($fp,$this->BUFFER);\n $reply = $this->strip_clf($reply);\n if($this->DEBUG)\n error_log(\"POP3 SEND [connect: $server] GOT [$reply]\",0);\n if(!$this->is_ok($reply)) {\n $this->ERROR = \"POP3 connect: \" . _(\"Error \") . \"[$reply]\";\n unset($this->FP);\n return false;\n }\n $this->FP = $fp;\n $this->BANNER = $this->parse_banner($reply);\n return true;\n }", "function connect()\n\t{\n\t\tglobal $lang, $mybb;\n\n\t\t$this->connection = @fsockopen($this->host, $this->port, $error_number, $error_string, $this->timeout);\n\n\t\t// DIRECTORY_SEPARATOR checks if running windows\n\t\tif(function_exists('stream_set_timeout') && DIRECTORY_SEPARATOR != '\\\\')\n\t\t{\n\t\t\t@stream_set_timeout($this->connection, $this->timeout, 0);\n\t\t}\n\n\t\tif(is_resource($this->connection))\n\t\t{\n\t\t\t$this->status = 1;\n\t\t\t$this->get_data();\n\t\t\tif(!$this->check_status('220'))\n\t\t\t{\n\t\t\t\t$this->fatal_error(\"The mail server is not ready, it did not respond with a 220 status message.\");\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif($this->use_tls || (!empty($this->username) && !empty($this->password)))\n\t\t\t{\n\t\t\t\t$helo = 'EHLO';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$helo = 'HELO';\n\t\t\t}\n\n\t\t\t$data = $this->send_data(\"{$helo} {$this->helo}\", 250);\n\t\t\tif(!$data)\n\t\t\t{\n\t\t\t\t$this->fatal_error(\"The server did not understand the {$helo} command\");\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif($this->use_tls && preg_match(\"#250( |-)STARTTLS#mi\", $data))\n\t\t\t{\n\t\t\t\tif(!$this->send_data('STARTTLS', 220))\n\t\t\t\t{\n\t\t\t\t\t$this->fatal_error(\"The server did not understand the STARTTLS command. Reason: \".$this->get_error());\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif(!@stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT))\n\t\t\t\t{\n\t\t\t\t\t$this->fatal_error(\"Failed to start TLS encryption\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// Resend EHLO to get updated service list\n\t\t\t\t$data = $this->send_data(\"{$helo} {$this->helo}\", 250);\n\t\t\t\tif(!$data)\n\t\t\t\t{\n\t\t\t\t\t$this->fatal_error(\"The server did not understand the EHLO command\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!empty($this->username) && !empty($this->password))\n\t\t\t{\n\t\t\t\tif(!preg_match(\"#250( |-)AUTH( |=)(.+)$#mi\", $data, $matches))\n\t\t\t\t{\n\t\t\t\t\t$this->fatal_error(\"The server did not understand the AUTH command\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif(!$this->auth($matches[3]))\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->fatal_error(\"Unable to connect to the mail server with the given details. Reason: {$error_number}: {$error_string}\");\n\t\t\treturn false;\n\t\t}\n\t}", "public function test_Imap() {\n \t// Stop here and mark this test as incomplete.\n\t\t$this->markTestIncomplete('This test has not been implemented yet.');\n\t\t\n// \t$service = $this->object->getProxiedService(PHPCAS_PROXIED_SERVICE_IMAP);\n// \t$service->setServiceUrl('imap://mail.example.edu/path/to/something');\n// \t$service->setMailbox('mailbox_name');\n// \t$service->setOptions(OP_READONLY);\n// \t$stream = $service->open();\n// \t$this->assertInternalType('resource', $stream);\n// \t$this->assertInternalType('resource', $service->getStream());\n// \t$this->assertEquals('PT-asdfas-dfasgww2323radf3', $service->getImapProxyTicket());\n\n }", "public function open() {\n\t\t$this->sock = fsockopen($this->protocol.$this->host, $this->port, $errno, $errstr, 2);\n\t\tfwrite($this->sock, $this->getHeaders()) or $this->error($errno, $errstr);\n\t}", "function open($adressServer, $port, $ti=2){\n $this->fp = @fsockopen($adressServer, $port, $this->errno, $errstr, $ti);\n if(!$this->fp){\n //utilisé pour le debug...\n //echo \"<b>echec d'ouverture $adressServer</b><br><font color=\\\"red\\\">$errstr ($errno).</font><hr>$this->EOL\";\n return;\n }\n $this->recv();\n }", "public function connect($server, $user, $pwd)\n {\n $this->mailbox = imap_open($server, $user, $pwd) or die('mailbox unreachable');\n\n return $this;\n }", "private function openConnection() {\r\n $socket = new TSocket($this->request->getClientIp(), '9090');\r\n\r\n $this->transport = new TBufferedTransport($socket);\r\n $protocol = new TBinaryProtocol($this->transport);\r\n\r\n // Create a calculator client\r\n $this->client = new OpenFileServiceClient($protocol);\r\n\r\n // Open up the connection\r\n $this->transport->open();\r\n \r\n }", "function connect( )\n\t{\n\t\t$num_args = func_num_args( );\n\t\t$args = func_get_args( );\n\n\t\t// get the arguments, if any\n\t\tif (0 != $num_args)\n\t\t{\n\t\t\t$this->load_arguments($args);\n\t\t}\n\n\t\t$this->linkid = @mysql_connect($this->host, $this->user, $this->pswd);\n\n\t\tif ( ! $this->linkid)\n\t\t{\n\t\t\t$this->error = mysql_errno( ).': '.mysql_error( );\n\t\t\t$this->error_report( );\n\n\t\t\tif ($this->error_debug)\n\t\t\t{\n\t\t\t\techo \"There was an error connecting to the server in {$this->file_name} on line {$this->line}:<br />ERROR - {$this->error}\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdie('There was a database error. An email has been sent to the system administrator.');\n\t\t\t}\n\t\t}\n\t}", "function open( $server, $user, $password, $dbName ) {\n\t\treturn true;\n\t}", "public function __construct()\n {\n global $mail_user, $mail_pass, $mail_server, $mail_port;\n // email login credentials\n $this->server = $mail_server;\n $this->user = $mail_user;\n $this->pass = $mail_pass;\n $this->port = $mail_port;\n\n $this->connect();\n $this->inbox();\n }", "function Connect() {\n\t\t\t\n\t\t\t// Enable error reporting for all errors\n\t\t\terror_reporting(E_ALL);\n\t\t\t$this->_Connection = ldap_connect($this->Server, $this->Port) or die('LDAP Fehler: ' . ldap_error($this->_Connection));\n\t\t\t\n\t\t\t// Set any protokoll options\n\t\t\tldap_set_option($this->_Connection, LDAP_OPT_PROTOKOL_OPTION, $this->ProtokollVersion);\n\t\t\t\n\t\t\t// Try to bind the local user to the serverconnection\n\t\t\tif ($this->UserName != '' && $this->Password != '') {\n\t\t\t\t$this->_UserBinding = ldap_bind($this->_Connection, $this->UserName, $this->Password) or die('LDAP Fehler: ' . ldap_error($this->_Connection));\n\t\t\t}\n\t\t\telse {\n\t\t\t\t\n\t\t\t\t// Try anonymous login\n\t\t\t\t$this->_UserBinding = ldap_bind($this->_Connection);\n\t\t\t}\n\t\t}", "function connect() {\n\t\t\t$this->conn = new remoteConnection($this->info[\"host\"], $this->info[\"port\"]);\n\t\t\tif ($this->conn->status()) {\n\t\t\t\t// connected, now saying hello!\n\t\t\t\treturn $this->login();\n\t\t\t} else {\n\t\t\t\t// there was a connection error for some strange reason\n\t\t\t\ttrigger_error(\"Couldn't open connection to SMTP server.\",E_USER_ERROR);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "function Open ($client=\"\",$user=\"\",$passwd=\"\",$lang=\"\") {\n if ( $this->rfc )\n return $this->SetStatus (SAPRFC_ERROR,\"SAPConnection::Open: Connection is \".\n \"already opened, close it first.\");\n\n switch ($this->connType) {\n case SAPRFC_CONN_NONE :\n return $this->SetStatus (SAPRFC_ERROR,\"SAPConnection::Open: Connection is \".\n \"is not defined.\");\n case SAPRFC_CONN_APPSERVER :\n $connect_data[\"ASHOST\"] = $this->appServer;\n $connect_data[\"SYSNR\"] = $this->systemNumber;\n break;\n\n case SAPRFC_CONN_LOGONGROUP :\n $connect_data[\"MSHOST\"] = $this->messageServer;\n $connect_data[\"R3NAME\"] = $this->R3SystemName;\n $connect_data[\"GROUP\"] = $this->logonGroup;\n break;\n\n case SAPRFC_CONN_USERDEFINED :\n $connect_data = $this->userLogonData;\n break;\n default :\n return $this->SetStatus (SAPRFC_ERROR,\"SAPConnection::Open: Unsupported connection type\");\n\n }\n\n if ( !empty ($client) ) $connect_data[\"CLIENT\"] = $client;\n if ( !empty ($user) ) $connect_data[\"USER\"] = $user;\n if ( !empty ($passwd) ) $connect_data[\"PASSWD\"] = $passwd;\n if ( !empty ($lang) ) $connect_data[\"LANG\"] = $lang;\n\n $this->rfc = @saprfc_open ($connect_data);\n if ( $this->rfc == false )\n return $this->SetStatus (SAPRFC_ERROR,@saprfc_error());\n\n if ($this->trace) $this->EnableTrace();\n else $this->DisableTrace();\n\n if (! empty ($this->codePage) ) $this->SetCodePage ($this->codePage);\n\n return ( $this->SetStatus (SAPRFC_OK,\"\") );\n\n }", "public function open()\r\n\t{\r\n\t\tif (!function_exists( 'mysql_connect' )) {\r\n\t\t\t$this->errorNum = 1;\r\n\t\t\t$this->errorMsg = 'The MySQL adapter \"mysql\" is not available.';\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!($this->resource = @mysql_connect( $this->host, $this->user, $this->password, true ))) {\r\n\t\t\t$this->errorNum = 2;\r\n\t\t\t$this->errorMsg = 'Could not connect to MySQL';\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tparent::open();\r\n\r\n\t\t$this->select($this->database);\r\n\t}", "public function login($username = '', $password = '', $apop = 1)\n {\n $return = array('type' => false, 'login' => false);\n // Issue empty command - some POP3 server constantly drop the first command sent to them\n // This is somewhat violating RFC1939 but who is mistaking here?\n // Mainly to blame is qmail at this point ...\n if (!$this->is_ssl) $this->noop();\n // Try to find out about POP3 AUTH and use it on success\n $capa = $this->capa(false);\n \n if ($this->has_tls && false !== $capa && isset($capa['stls']) && $capa['stls']) {\n //echo \"aa\";exit;\t\n $this->talk('STLS');\n $res = stream_socket_enable_crypto($this->fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);\n if (!$res) {\n $this->close();\n $this->set_error('Cannot enable TLS, although server advertises it');\n } else {\n $this->is_tls = true;\n $return['type'] = 'secure';\n }\n \n // Now check, whether the connections has not been closed\n if (!$this->alive()) {\n $this->set_error($response);\n $this->close();\n sleep($this->reconnect_sleep);\n $this->connect($this->server, $this->port);\n if (!$this->alive()) return $return;\n if (!$this->is_ssl) $this->noop();\n }\n \n }\n // Server supports POP3 AUTH... try the supported mechanisms to authenticate\n \n if (!$this->is_ssl && !$this->is_tls && false !== $capa && $capa['sasl'] != false) {\n \t//echo \"bb\";exit;\n // Find the mechanisms supported on both sides\n $SASL = array_intersect($this->SASL, $capa['sasl_internal']);\n $this->is_auth = false;\n foreach ($SASL as $v) {\n $function_name = '_auth_'.$v;\n if ($this->{$function_name}($username, $password)) {\n $return['login'] = 1;\n $return['type'] = 'secure';\n return $return;\n }\n }\n // Now check, whether the connections has not been closed\n if (!$this->alive()) {\n $this->set_error($response);\n $this->close();\n sleep($this->reconnect_sleep);\n $this->connect($this->server, $this->port);\n if (!$this->alive()) return $return;\n if (!$this->is_ssl) $this->noop();\n }\n \n }\n // APOP\n if (!$this->is_ssl && !$this->is_tls && 1 != $return['login']\n && preg_match('/(<.+@.+>)$/', $this->greeting, $token) && $apop == 1) {\n \t//echo \"cc\";exit;\n $response = $this->talk('APOP '.$username.' '.md5($token[1].$password));\n if (strtolower(substr($response, 0, 3)) == '+ok') {\n $return['login'] = 1;\n $return['type'] = 'secure';\n return $return;\n }\n // APOP failed due to bogus server advertising\n // Now check, whether the connections has not been closed\n if (!$this->alive()) {\n $this->set_error($response);\n $this->close();\n sleep($this->reconnect_sleep);\n $this->connect($this->server, $this->port);\n if (!$this->alive()) return $return;\n if (!$this->is_ssl) $this->noop();\n }\n \n }\n // USER/PASS\n if (1 != $return['login']) {\n \t//echo \"----x\";\n \t//echo \"ee\";\n \t//echo 'USER ';\n \t//exit;\n $response = $this->talk('USER '.$username);\n if (strtolower(substr($response, 0, 4)) == '-err') {\n $this->set_error($response);\n if (!$this->alive()) return $return;\n }\n $response = $this->talk('PASS '.$password);\n //echo $response;exit;\n if (strtolower(substr($response, 0, 3)) == '+ok') {\n \t//echo \"aa\";\n $return['login'] = 1;\n $return['type'] = 'normal';\n } else {\n $this->set_error($response);\n if (!$this->alive()) return $return;\n }\n \n }\n //print_r($return);\n \n return $return;\n }", "public function openLocal($filePath)\n {\n set_time_limit(6000);\n\n if (!$this->testMode) {\n $this->mailboxLink = imap_open($filePath, '', '', CL_EXPUNGE | ($this->testMode ? OP_READONLY : 0));\n } else {\n $this->mailboxLink = imap_open($filePath, '', '', ($this->testMode ? OP_READONLY : 0));\n }\n\n if (!$this->mailboxLink) {\n $this->errorMessage = 'Cannot open the mailbox file to ' . $filePath . $this->bmhNewLine . 'Error MSG: ' . imap_last_error();\n $this->output();\n\n return false;\n }\n\n $this->output('Opened ' . $filePath);\n\n return true;\n }", "function verify_remote_info($server,$port,$remote_user,$remote_pwd,$type='imap') {\n\t$mailbox = '{'.$server.':'.$port.'/'.$type.'/ssl}INBOX';\n\t$imap = imap_open($mailbox,$remote_user,$remote_pwd);\n\tif(!$imap) {\n\t\timap_close($imap);\n\t\treturn false;\n\t}\n\timap_close($imap);\n\treturn true;\n}", "private function open_conn()\n {\n global $slm_db;\n\n try\n {\n # MySQL with PDO_MYSQL, open the connection using persistent connection\n $this->db_handler = new PDO(\"mysql:host=\".$this->host.\";dbname=\".$this->dbname, $this->login, $this->password, array(PDO::ATTR_PERSISTENT => true));\n\n # we set the error mode and error log\n $this->error_mode = $slm_db['error_mode'];\n $this->error_log = $slm_db['error_log'];\n }\n catch (PDOException $e)\n {\n error_log($e->getMessage().PHP_EOL, 3, $this->error_log);\n }\n\n }", "public function connect()\n {\n $this->fileDescriptor = @fsockopen(\n $this->parameters['server_host'],\n $this->parameters['server_port']\n );\n\n if (false === $this->fileDescriptor) {\n $this->output->manageMessageOfGivenLogLevel('Error: Could not connect to the NetSoul server', Logger::CRITICAL);\n die();\n }\n\n $rawResponse = fgets($this->fileDescriptor);\n $this->output->manageMessageOfGivenLogLevel('Server: '.$rawResponse, Logger::INFO);\n\n $this->connectionResponse = new ConnectionResponse();\n $this->connectionResponse->setAttributesFromRawResponse($rawResponse);\n }" ]
[ "0.73398787", "0.71422523", "0.7052209", "0.69406134", "0.6658195", "0.6393773", "0.63850397", "0.6026572", "0.5975428", "0.5944171", "0.58419394", "0.5801815", "0.5758728", "0.57571685", "0.56785387", "0.56288457", "0.55860436", "0.54905117", "0.54252803", "0.5389153", "0.5388965", "0.53655213", "0.53546715", "0.5218352", "0.5200508", "0.51882994", "0.51848876", "0.51752406", "0.51629406", "0.51561046" ]
0.762322
0
move the message to a new folder
function move($msg_index, $folder='INBOX.Processed') { // move on server imap_mail_move($this->conn, $msg_index, $folder); imap_expunge($this->conn); // re-read the inbox $this->inbox(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function move_message()\n\t{\n\t\t$param['current_folder'] = '';\n\n\t\tif ($this->input->post('type'))\n\t\t{\n\t\t\t$param['type'] = $this->input->post('type');\n\t\t}\n\t\tif ($this->input->post('current_folder'))\n\t\t{\n\t\t\t$param['current_folder'] = $this->input->post('current_folder');\n\t\t}\n\t\tif ($this->input->post('number'))\n\t\t{\n\t\t\t$param['number'] = $this->input->post('number');\n\t\t}\n\t\tif ($this->input->post('id_folder'))\n\t\t{\n\t\t\t$param['id_folder'] = $this->input->post('id_folder');\n\t\t}\n\t\tif ($this->input->post('folder'))\n\t\t{\n\t\t\t$param['folder'] = $this->input->post('folder');\n\t\t}\n\t\tif ($this->input->post('id_message'))\n\t\t{\n\t\t\t$param['id_message'][0] = $this->input->post('id_message');\n\t\t}\n\n\t\tif (isset($param['type']) && $param['type'] === 'single' && isset($param['folder']) && $param['folder'] === 'inbox')\n\t\t{\n\t\t\t$multipart = array('type' => 'inbox', 'option' => 'check', 'id_message' => $param['id_message'][0]);\n\t\t\t$tmp_check = $this->Message_model->get_multipart($multipart);\n\t\t\tif ($tmp_check->row('UDH') !== '')\n\t\t\t{\n\t\t\t\t$multipart = array('option' => 'all', 'udh' => substr($tmp_check->row('UDH'), 0, 8));\n\t\t\t\t$multipart['phone_number'] = $tmp_check->row('SenderNumber');\n\t\t\t\tforeach ($this->Message_model->get_multipart($multipart)->result() as $part)\n\t\t\t\t{\n\t\t\t\t\t$param['id_message'][] = $part->ID;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->Message_model->move_messages($param);\n\t}", "public function move($msg_index, $folder = 'INBOX.Processed')\n {\n // move on server\n imap_mail_move($this->conn, $msg_index, $folder);\n imap_expunge($this->conn);\n\n // re-read the inbox\n $this->inbox();\n echo '... ';\n }", "public function MoveMessage($folderid, $id, $newfolderid)\n\t{\n\t\tdebugLog(__METHOD__.\"('$folderid', $id, '$newfolderid') NOT supported!\");\n\t\treturn false;\n\t}", "function moveFolder($folderId) {\n\t\tif(!empty($this->id)) {\n\t\t\tglobal $dbi;\n\n\t\t\t// Update parent folder for this folder\n\t\t\t$dbi->query(\"UPDATE \".folderTableName.\" SET parentId=\".$dbi->quote($folderId).\" WHERE id=\".$dbi->quote($this->id));\n\t\t}\t\n\t}", "public function moveFolderWithinStorage($sourceFolderIdentifier, $targetFolderIdentifier, $newFolderName);", "public function reset_folder_data()\r\n {\r\n\t\t$media = new Plugin\\Media;\r\n\t\t\r\n\t\treturn $media->move($this->folder_id, $this->media_ids);\r\n\t}", "public function testMoveFolder(){\n\t\t\t$newParentID = rand(0, 999999999);\n\t\t\t$folderD = rand(0, 999999999);\n\t\t\t\n\t $model = $this->getMock(\"Model\", array(\"moveFolder\"));\n\t \n\t $model->expects($this->once())\n\t ->method(\"moveFolder\")\n\t ->with($this->equalTo($newParentID),\n\t\t\t\t\t \t\t$this->equalTo($folderD));\n\t \n\t $result = NoteBook::moveFolder($model, $folderD, $newParentID);\n\t\t\t\n\t\t\t$this->assertEquals($result, \"\");//No output expected\n\t\t}", "public function move(Folder $destinationFolder) {\n\t\tif (!$this->exists()) {\n\t\t\tthrow new Exception(\"Folder '\" . $this->getPath() . \"' does not exist\");\n\t\t}\n\n\t\tif ($destinationFolder->exists()) {\n\t\t\tthrow new Exception(\"Destination folder already exists!\");\n\t\t}\n\n//\t\tif(is_link($this->path)){\n//\t\t\t$link = new File($this->path);\n//\t\t\treturn $link->move(new File($destinationFolder->path()));\n//\t\t}\n\n\t\tif($destinationFolder->isDescendantOf($this)){\n\t\t\tthrow new Exception(\"Can't move this folder into a child folder!\");\n\t\t}\n\n\t\t$newPath = $destinationFolder->getPath();\n\n\t\t//do nothing if path is the same.\n\t\tif ($newPath === $this->getPath()) {\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t$success = false;\n\t\ttry{\n\t\t\t$success = rename($this->getPath(), $newPath);\n\t\t} catch(\\Exception $e) {\n\t\t\t//rename fails accross partitions. Ignore and retry with copy delete.\n\t\t\tGO()->debug(\"Rename failed. Falling back on copy, delete\");\n\t\t}\n\n\t\tif (!$success) { // Notice suppressed by @\n\t\t\t//\tthrow new Exception(\"Rename failed\");\n\t\t\t// If renaming is throwing an error then do it the old way.\n\t\t\t// This is done because of problems when moving items across partitions.\n\t\t\t// See https://bugs.php.net/bug.php?id=50676 for more info about this.\n\t\t\t// If rename fails then try the old method\n\t\t\t$movedFolder = new Folder($newPath);\n\t\t\t$movedFolder->create();\n\n\t\t\t$ls = $this->getChildren(true);\n\t\t\tforeach ($ls as $fsObject) {\n\t\t\t\tif ($fsObject->isFile()) {\n\t\t\t\t\t$fsObject->move($movedFolder->getFile($fsObject->getName()));\n\t\t\t\t} else {\n\t\t\t\t\t$fsObject->move($movedFolder->getFolder($fsObject->getName()));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->delete();\n\n\t\t\t$newPath = $movedFolder->getPath();\n\t\t}\n\n\t\t$this->path = $newPath;\n\n\t\treturn true;\n\t}", "public function moveFolderAction($id, $action) {\r\n\t$em = $this -> getDoctrine() -> getManager();\r\n\t\t$folderToMove = $em -> getRepository('AcsilServerAppBundle:Folder') -> findOneBy(array('id' => $id));\r\n\t\tif (!$folderToMove) {\r\n\t\t\tthrow $this -> createNotFoundException('No folder found for id ' . $id);\r\n\t\t}\r\n\t\tif ($action != 0 && $action != 1) {\r\n\t\t\tthrow $this -> createNotFoundException('Unknown action: ' . $action);\r\n\t\t}\r\n\t$isExist = $em -> getRepository('AcsilServerAppBundle:MoveFile') -> findOneBy(array('fileId' => $id));\r\n\tif ($isExist)\r\n\t{\r\n\t$em -> remove($isExist);\r\n\t}\r\n\t$folderId = $folderToMove->getParentFolder();\r\n\t\t$allToMove = $em \r\n\t\t\t-> getRepository('AcsilServerAppBundle:MoveFile') \r\n\t\t\t-> findAll();\r\n\t\t\tforeach ($allToMove as $move) {\r\n\t\t\tif (strpos($folderToMove->getAbsolutePath(), $move->getPath()) !== false)\r\n\t\t\t\t{\r\n\t\treturn $this -> redirect($this -> generateUrl('_managefile', array(\r\n 'folderId' => $folderId,\r\n )));\r\n\t\t\t\t}\r\n\t\t\tif (strpos($move->getPath(), $folderToMove->getAbsolutePath()) !== false)\r\n\t\t\t\t{\r\n\t\t\t\t$em -> remove($move);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t$move = new MoveFile();\r\n\t$move-> setName($folderToMove->getName());\r\n\t$move-> setAction($action);\r\n\t$move-> setFileId($id);\r\n\t$move-> setPath($folderToMove->getAbsolutePath());\r\n\t$move->setIsFolder(1);\r\n\t$em -> persist($move);\r\n\t$em -> flush();\r\n\t\treturn $this -> redirect($this -> generateUrl('_managefile', array(\r\n 'folderId' => $folderId,\r\n )));\r\n\t}", "function move_messages($options = array())\n\t{\n\t\t// default values\n \t$options = $this->_default(array('trash' => FALSE), $options);\n \t$trash = ($options['trash']) ? '1':'0';\n \t\t\t\n\t\tswitch($options['type']) \n\t\t{\t\n\t\t\tcase 'conversation':\n\t\t\t$id_folder = $options['id_folder'];\n\t\t\t$number = $options['number'];\n\t\t\t\t\t\n\t\t\t//if(!isset($options['current_folder'])) { $inbox_folder=1; $sentitems_folder=3; }\t\t\n\t\t\t//if($options['current_folder']=='')\n\t\t\tif(!isset($options['current_folder'])) \n\t\t\t{ \n\t\t\t\t$inbox_folder=1;\n\t\t\t\t$sentitems_folder=3; \n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$inbox_folder=$sentitems_folder=$options['current_folder'];\n\t\t\t}\n\t\t\t\n\n\t\t\t// start transcation\t\t\n\t\t\t$this->db->trans_start();\n\t\t\t\t\t\t\t\n\t\t\t// proccess inbox\n\t\t\t$this->db->select('ID');\n\t\t\t$this->db->from('inbox');\n\t\t\t$this->db->where('id_folder', $inbox_folder);\n\t\t\t$this->db->where('SenderNumber', $number);\n\t\t\t$this->db->join('user_inbox', 'user_inbox.id_inbox = inbox.ID');\n\t\t\t$res = $this->db->get();\n\t\t\tif ($res->num_rows() > 0)\n\t\t\t{\n\t\t\t\tforeach ($res->result_array() as $row)\n\t\t\t\t{\n\t\t\t\t\t$ids[] = $row['ID'];\n\t\t\t\t}\n\t\t\t\t$this->db->set('id_folder', $id_folder);\n\t\t\t\t$this->db->where_in('ID', $ids);\t\t\n\t\t\t\t$this->db->update('inbox');\n\t\t\t\t$this->db->set('trash', $trash);\n\t\t\t\t$this->db->where_in('id_inbox', $ids);\n\t\t\t\t$this->db->update('user_inbox');\n\t\t\t}\n\n\t\t\t// proccess sentitems\n\t\t\t$this->db->select('ID');\n\t\t\t$this->db->from('sentitems');\n\t\t\t$this->db->where('id_folder', $sentitems_folder);\n\t\t\t$this->db->where('DestinationNumber', $number);\n\t\t\t$this->db->join('user_sentitems', 'user_sentitems.id_sentitems = sentitems.ID');\n\t\t\t$res = $this->db->get();\n\t\t\tif ($res->num_rows() > 0)\n\t\t\t{\n\t\t\t\tforeach($res->result_array() as $row)\n\t\t\t\t{\n\t\t\t\t\t$ids[] = $row['ID'];\n\t\t\t\t}\n\t\t\t\t$this->db->set('id_folder', $id_folder);\n\t\t\t\t$this->db->where_in('ID', $ids);\t\t\n\t\t\t\t$this->db->update('sentitems');\n\t\t\t\t$this->db->set('trash', $trash);\n\t\t\t\t$this->db->where_in('id_sentitems', $ids);\n\t\t\t\t$this->db->update('user_sentitems');\n\t\t\t}\n\n\t\t\t$this->db->trans_complete();\n\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 'single':\n\t\t\t$folder = $options['folder'];\n\t\t\t$id_folder = $options['id_folder'];\n\t\t\t$id_message = $options['id_message'];\t\t\t\n\t\t\t$user_folder = \"user_\".$folder; // add user prefix\n\t\t\t$id_folder_field = \"id_\".$folder; // add id prefix\n\n\t\t\tforeach($id_message as $tmp):\n\t\t \t\t$this->db->set('a.id_folder', $id_folder);\n\t\t\t\t$this->db->set('b.trash', $trash);\n\t\t\t\t$this->db->where('a.ID', $tmp);\n\t\t\t\t$update_id_folder_field = 'b.'.$id_folder_field;\n\t\t\t\t$this->db->where($this->_protect_identifiers('a.ID'), $this->_protect_identifiers($update_id_folder_field), FALSE);\n\t\t\t\t$update_folder = $this->_protect_identifiers($folder);\n\t\t\t\t$update_folder_alias = $this->_protect_identifiers('a');\n\t\t\t\t$update_user_folder = $this->_protect_identifiers($user_folder);\n\t\t\t\t$update_user_folder_alias = $this->_protect_identifiers('b');\t\t\t\t\n\t\t\t\t$this->db->update($update_folder.' as '.$update_folder_alias.', '.$update_user_folder.' as '.$update_user_folder_alias);\n\t\t\tendforeach;\n\t\t\tbreak;\n\t\t}\n\t}", "public function testFoldersMove()\n {\n }", "private function move()\r\n\t{\r\n\t\t//create the new filename\r\n\t\t$newfile = basename(str_replace('/','-',$this->file), self::BASE_EXTENSION) . self::BASE_EXTENSION;\r\n\t\t//copy it\r\n\t\tcopy($this->file, self::$serverPath_cache . $newfile);\r\n\t\t//modify our var\r\n\t\t$this->file = self::$serverPath_cache . $newfile;\r\n\t\t//return\r\n\t\treturn self::$HTTPPath_cache. $newfile;\r\n\t}", "public function move($file, $newPath);", "function move_message($uids, $to_mbox, $from_mbox='')\n {\n $fbox = $from_mbox;\n $tbox = $to_mbox;\n $to_mbox = $this->mod_mailbox($to_mbox);\n $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox;\n\n list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox);\n\n // exit if no message uids are specified\n if (empty($uids))\n return false;\n\n // make sure mailbox exists\n if ($to_mbox != 'INBOX' && !$this->mailbox_exists($tbox, true)) {\n if (in_array($tbox, $this->default_folders))\n $this->create_mailbox($tbox, true);\n else\n return false;\n }\n\n // flag messages as read before moving them\n $config = cmail::get_instance()->config;\n if ($config->get('read_when_deleted') && $tbox == $config->get('trash_mbox')) {\n // don't flush cache (4th argument)\n $this->set_flag($uids, 'SEEN', $fbox, true);\n }\n\n // move messages\n $move = $this->conn->move($uids, $from_mbox, $to_mbox);\n $moved = !($move === false || $move < 0);\n\n // send expunge command in order to have the moved message\n // really deleted from the source mailbox\n if ($moved) {\n $this->_expunge($from_mbox, false, $uids);\n $this->_clear_messagecount($from_mbox);\n $this->_clear_messagecount($to_mbox);\n }\n // moving failed\n else if ($config->get('delete_always', false) && $tbox == $config->get('trash_mbox')) {\n $moved = $this->delete_message($uids, $fbox);\n }\n\n if ($moved) {\n // unset threads internal cache\n unset($this->icache['threads']);\n\n // remove message ids from search set\n if ($this->search_set && $from_mbox == $this->mailbox) {\n // threads are too complicated to just remove messages from set\n if ($this->search_threads || $all_mode)\n $this->refresh_search();\n else {\n $uids = explode(',', $uids);\n foreach ($uids as $uid)\n $a_mids[] = $this->_uid2id($uid, $from_mbox);\n $this->search_set = array_diff($this->search_set, $a_mids);\n }\n }\n\n // update cached message headers\n $cache_key = $from_mbox.'.msg';\n if ($all_mode || ($start_index = $this->get_message_cache_index_min($cache_key, $uids))) {\n // clear cache from the lowest index on\n $this->clear_message_cache($cache_key, $all_mode ? 1 : $start_index);\n }\n }\n\n return $moved;\n }", "public function testMoveDirectoryMovesEntireDirectory()\n {\n mkdir(self::$temp . DS . 'tmp2', 0755, true);\n mkdir(self::$temp . DS . 'tmp2' . DS . 'nested', 0755, true);\n file_put_contents(self::$temp . DS . 'tmp2' . DS . 'foo.txt', 'foo');\n file_put_contents(self::$temp . DS . 'tmp2' . DS . 'nested' . DS . 'bar.txt', 'bar');\n\n Storage::mvdir(self::$temp . DS . 'tmp2', self::$temp . DS . 'tmp3');\n\n $this->assertTrue(is_dir(self::$temp . DS . 'tmp3'));\n $this->assertTrue(is_dir(self::$temp . DS . 'tmp3' . DS . 'nested'));\n $this->assertTrue(is_file(self::$temp . DS . 'tmp3' . DS . 'foo.txt'));\n $this->assertTrue(is_file(self::$temp . DS . 'tmp3' . DS . 'nested' . DS . 'bar.txt'));\n\n $this->assertFalse(is_dir(self::$temp . DS . 'tmp2'));\n }", "public function move ($existingFilePath, $newFilePath);", "function mkFolder($oriFolder, $movieTitle, $lang = 'english')\r\n{\r\n $folderPath = MV_PATH . DIRECTORY_SEPARATOR . $lang . DIRECTORY_SEPARATOR;\r\n // Create target dir\r\n if (is_dir($folderPath . $oriFolder)) {\r\n if (is_dir($folderPath . $movieTitle)) {\r\n echo \"Already Exist Please check\";\r\n }\r\n echo \"YES\";\r\n //if(rename($folderPath, $loc.DIRECTORY_SEPARATOR.$folderName)){\r\n //}\r\n }\r\n}", "private function _move()\n\t{\n\t\t// Login check\n\t\tif (User::isGuest())\n\t\t{\n\t\t\treturn $this->_login();\n\t\t}\n\n\t\t// Authorization check\n\t\tif (!$this->params->get('access-edit-item'))\n\t\t{\n\t\t\t$this->setError(Lang::txt('PLG_MEMBERS_' . strtoupper($this->_name) . '_NOT_AUTHORIZED'));\n\t\t\treturn $this->_collections();\n\t\t}\n\n\t\t// Incoming\n\t\t$post = \\Components\\Collections\\Models\\Post::getInstance(Request::getInt('post', 0));\n\n\t\tif (!$post->move(Request::getInt('board', 0)))\n\t\t{\n\t\t\t$this->setError($post->getError());\n\t\t}\n\n\t\t$route = Route::url($this->member->link() . '&active=' . $this->_name);\n\n\t\tif (Request::getInt('no_html', 0))\n\t\t{\n\t\t\techo $route;\n\t\t\texit;\n\t\t}\n\n\t\tApp::redirect($route);\n\t}", "public function move($parent_id){\n if($parent_id<0){\n throw new InvalidArgumentException('Invalid $parent_id passed to move()');\n return FALSE;\n }\n $code=$this->responseCode($this->call('move', array('folder_id'=>$this->id, 'parent_id'=>$parent_id), TRUE) );\n if($code==14002){\n $this->parent_id=$parent_id;\n return $this;\n }\n return FALSE;\n }", "abstract function move($sourcePath, $destinationPath);", "public function moveFileWithinStorage($fileIdentifier, $targetFolderIdentifier, $newFileName);", "function move_file($file_id, $to_folder) {\n // database record, and removing the old record (to prevent losing a file\n // on failure). Note that this function requires the to_folder not have a \n // file with this name already. \n $record = $this->getById($file_id);\n if ($record === false) {\n return false;\n }\n $file_path_old = $record->filepath;\n $file_path_new = $to_folder . '/' . $record->filename_original;\n if (file_exists(DATA_PATH . $file_path_new )) {\n return false;\n }\n if (!file_exists(DATA_PATH . $file_path_old)) {\n return false;\n }\n if (!file_exists(DATA_PATH . $to_folder)) {\n mkdir(DATA_PATH . $to_folder, $this->config->item('content_directories_mode'), true);\n }\n $cp_result = copy(DATA_PATH . $file_path_old, DATA_PATH . $file_path_new);\n if ($cp_result === false) {\n return false;\n }\n \n $db_result = $this->File->update($file_id, array('filepath' => $file_path_new));\n if ($db_result === false) {\n // problem! try to remove the new copy\n unlink(DATA_PATH . $file_path_new);\n return false;\n } else {\n // all OK. try to remove the old copy\n unlink(DATA_PATH . $file_path_old);\n return true;\n }\n }", "private function _move($filename){\n return $this->_tc_fm->store($filename, $this->_tc_fm->generated() . '/' . $filename, FM::STORE_MOVE);\n }", "function move_note($note, $list_id)\n {\n $this->_read_lists();\n\n $tofolder = $this->get_folder($list_id);\n $fromfolder = $this->get_folder($note['list']);\n\n if ($fromfolder && $tofolder) {\n return $fromfolder->move($note['uid'], $tofolder->name);\n }\n\n return false;\n }", "function new_folder() {\r\n\r\n\tglobal $template, $db, $lang, $session, $functions;\r\n\r\n\t$template->set_page_title($lang['MessengerCreatingNewFolder']);\r\n\t\r\n\t//\r\n\t// Was the form submitted?\r\n\t//\r\n\r\n\tif(array_key_exists('submit', $_POST)) {\r\n\r\n\t\t//\r\n\t\t// Missing fields?\r\n\t\t//\r\n\r\n\t\tif(!array_key_exists('folder_title', $_POST)) {\r\n\r\n\t\t\t$template->parse('msgbox', array(\r\n\r\n\t\t\t\t'box_title' => $lang['Error'],\r\n\t\t\t\t'content' => sprintf($lang['MissingFields'], 'folder_title')\r\n\t\t\t\t)\r\n\t\t\t\t\t\r\n\t\t\t);\r\n\r\n\t\t} else {\r\n\t\t\r\n\t\t\t$folder_title = (get_magic_quotes_gpc()) ? $_POST['folder_title'] : addslashes($_POST['folder_title']);\r\n\r\n\t\t\t//\r\n\t\t\t// Insert into the database.\r\n\t\t\t//\r\n\r\n\t\t\t$db->query('INSERT INTO '.TABLE_PREFIX.'folders (folder_title, folder_user_id) VALUES (\"'. trim($folder_title) .'\", \"'. $session->sess_info['user_info']['id'] .'\")');\r\n\r\n\t\t\t$template->parse('msgbox', array(\r\n\r\n\t\t\t\t'box_title' => $lang['MessengerCreatingNewFolder'],\r\n\t\t\t\t'content' => $lang['MessengerFolderCreated']\r\n\t\t\t\t\r\n\t\t\t\t)\r\n\r\n\t\t\t);\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\t//\r\n\t\t// form, order up\r\n\t\t// \r\n\r\n\t\t$template->parse('messenger_new_folder_form', array(\r\n\r\n\t\t\t'form_url' => $functions->make_url('panel.php', array('act' => 'messenger', 'op' => 'new_folder')),\r\n\t\t\t'folder_title' => $lang['MessengerFolderTitle'],\r\n\t\t\t'create_folder' => $lang['MessengerCreateFolder'],\r\n\t\t\t'creating_new_folder' => $lang['MessengerCreatingFolder'],\r\n\r\n\t\t\t)\r\n\r\n\t\t);\r\n\r\n\t}\r\n\r\n}", "function move(string $oldRoot, string $newRoot): void\n {\n $oldRoot = str_replace(\".\", \"\", $oldRoot);\n $newRoot = str_replace(\".\", \"\", $newRoot);\n if (!empty($oldRoot)) {\n if (parent::isFileTool($this->folderRoot . $oldRoot)) {\n parent::fileMoveTool($this->folderRoot . $oldRoot, $this->folderRoot . $newRoot);\n } else {\n parent::folderMoveTool($this->folderRoot . $oldRoot, $this->folderRoot . $newRoot);\n }\n }\n }", "public function ChangeMessage($folderid, $id, $input, $contentParameters) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'START ChangeMessage { folderid = ' . $folderid . '; id = ' . $id . '; input = SyncObject }');\n\n // check if the message is in the current syncinterval\n if (($id != \"\") && (!$this->isZimbraObjectInSyncInterval($folderid, $id, $contentParameters)))\n throw new StatusException(sprintf(\"Zimbra->DeleteMessage('%s'): Message is outside the sync interval and so far not deleted.\", $id), SYNC_STATUS_OBJECTNOTFOUND);\n\n\n // When Zimbra moves an item from a folder owned by one UserID to a folder owned by another UserID\n // it assigns the item a new ID in the recipients mailbox. There is no way to return this updated ID\n // to this function - so if we allow the move to proceed, we end up with an incorrect item ID in the \n // recipient folder. There is also no way to easily tell the client to refresh both folders if they \n // are not both Ping'ed folders. Any attempt to perform a further action on the moved item will\n // generate a SOAP Error. SO, THE SAFEST APPROACH IS TO PREVENT MOVING ITEMS BETWEEN ACCOUNTS\n // All linked folders have an id of the form [Folder Type][Owner Identifier]-[Owner's Folder ID]\n // For example, FL0-2. All folders with no '-' in the folderId are owned by the synching user.\n\n\n if (strpos($folderid, '-') === false) {\n $folderOwner = 'ME';\n } else {\n $folderOwnerId = explode( '-', $folderid );\n $folderOwner = $folderOwnerId[0];\n }\n\n // Note: Check for '-' failing also caters for a new item where the id will be empty\n if (strpos($id, '-') === false) {\n $idOwner = 'ME';\n } else {\n $idOwnerId = explode( '-', $id );\n $idOwner = $idOwnerId[0];\n }\n\n // Only attempt to import TAGS/Categiries if the folder is owned by the user\n $inputtags = \"\";\n $inputattribute = \"\";\n if (isset($input->categories) and is_array($input->categories)) {\n if (('ME' == $folderOwner) && ('ME' == $idOwner)) {\n $inputTagIds = $this->CategoriesToTags($input->categories);\n\t\t\t\t\n $inputtags = implode( \",\",$inputTagIds);\n $inputattribute = ' t=\"'.$inputtags.'\" ';\n\n } else {\n ZLog::Write(LOGLEVEL_INFO, 'Zimbra->ChangeMessage(): ' . 'Shared folder - Stripping client supplied Categories from input item to prevent the update failing!' );\n }\n }\n\n if ($folderOwner != $idOwner) {\n/*\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage { PREVENTED FROM MOVING ITEMS BETWEEN ACCOUNTS }');\n $clearCacheList[] = $this->changesSinkFolders[$mods[$i]['id']];\n $clearCacheList = array();\n $this->ClearCache( $clearCacheList );\n throw new StatusException(\"Zimbra->ChangeMessage(): PREVENTED FROM MOVING ITEMS BETWEEN ACCOUNTS \", SYNC_STATUS_CLIENTSERVERCONVERSATIONERROR);\n return false;\n*/\n }\n\n if ($this->_localCache) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ChangeMessage - CLEARING CACHE for folder ['.$folderid.']' );\n unset($this->_cachedMessageLists[$folderid]);\n $this->_cachedMessageLists['changed'] = true;\n }\n\n\n $index = $this->GetFolderIndex($folderid);\n $zimbraFolderId = $this->_folders[$index]->id;\n $view = $this->_folders[$index]->view;\n $folderpath = $this->_folders[$index]->path;\n if (isset($this->_folders[$index]->owner)) {\n $zimbraFolderOwner = $this->_folders[$index]->owner;\n } else {\n $zimbraFolderOwner = '';\n }\n\n switch ($view) {\n case 'message':\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ChangeMessage CALLED for an EMAIL ! - updating \"flag\" or \"categories\"' );\n\n/*\n if (isset($input->categories) and is_array($input->categories)) {\n $msgTagIds = $this->CategoriesToTags($input->categories);\n\t\t\t\t\n $msgtags = implode( \",\",$msgTagIds);\n $tagattribute = ' t=\"'.$msgtags.'\" ';\n\n } else {\n $msgtags = \"\";\n $tagattribute = \"\";\n }\n*/\n\n $stat = $this->StatMessage( $this->_folders[$index]->devid, $id );\n//ZLog::Write(LOGLEVEL_DEBUG, 'Stat ['.print_r( $stat, true ) .']' );\n if (isset($input->flag->flagstatus) && ($input->flag->flagstatus == 2)) {\n//ZLog::Write(LOGLEVEL_DEBUG, 'Setting Flag' );\n $result = $this->SetMessageFlag($this->_folders[$index]->devid, $id, $input->flag->flagstatus);\n } elseif (isset($input->flag->flagstatus) && ($input->flag->flagstatus == 1)) {\n//ZLog::Write(LOGLEVEL_DEBUG, 'Clearing Flag' );\n $result = $this->SetMessageFlag($this->_folders[$index]->devid, $id, 0);\n } else {\n//ZLog::Write(LOGLEVEL_DEBUG, 'UnSetting Flag' );\n $result = $this->SetMessageFlag($this->_folders[$index]->devid, $id, 0);\n }\n\n // Modifying existing message - Cannot apply TAGS to shared items - so don't even try\n// if (strrpos($id,':') === false) {\n if ('ME' == $idOwner) {\n\n $soap ='<ItemActionRequest xmlns=\"urn:zimbraMail\">\n <action id=\"'.$id.'\" op=\"update\" t=\"'.$inputtags.'\" />\n </ItemActionRequest> ';\n $returnJSON = true;\n $actionResponse = $this->SoapRequest($soap, false, false, $returnJSON);\n if($actionResponse) {\n $actionArray = json_decode($actionResponse, true);\n if (!isset($actionArray['Body']['ItemActionResponse']['action']['id']) or !isset($actionArray['Body']['ItemActionResponse']['action']['op'])) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ChangeMessage MESSAGE TAG update failed');\n }\n }\n unset($actionResponse);\n }\n\n if ($result) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage MESSAGE (flag/categories) { true }');\n return $this->StatMessage($this->_folders[$index]->devid, $id);\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage MESSAGE (flag/categories) { false }');\n return false;\n }\n\n break;\n\n case 'contact':\n\n/*\n$supportedFields = ZPush::GetDeviceManager()->GetSupportedFields($folderid);\nZLog::Write(LOGLEVEL_DEBUG, 'Supported Fields: '. print_r( $supportedFields, true ) );\n*/\n // TODO Does this have something to do with virtual contacts???\n //if(isset($input->categories)){\n // $fid = $this->GetFolderID($input->categories[0]); FYI - GetFolderID Removed\n\n // // folder exists\n // if($fid != 0) {\n // $foldername = $input->categories[0];\n // $zimbraFolderId = $fid;\n\n // if($id <> '') {\n // $this->MoveMessage($foldername,$id,$fid);\n // }\n // }\n //}\n\n// if (isset($input->categories) and (trim($input->categories) != \"\")) {\n/*\n if (isset($input->categories) and is_array($input->categories)) {\n $contactTagIds = $this->CategoriesToTags($input->categories);\n\t\t\t\t\n $contacttags = implode( \",\",$contactTagIds);\n $tagattribute = ' t=\"'.$contacttags.'\" ';\n\n } else {\n $contacttags = \"\";\n $tagattribute = \"\";\n }\n*/\n\n if($id == '') {\n $soap = '<CreateContactRequest xmlns=\"urn:zimbraMail\" verbose=\"0\"><cn l=\"'.$zimbraFolderId.'\" '.$inputattribute.' >';\n } else {\n $soap = '<ModifyContactRequest xmlns=\"urn:zimbraMail\" verbose=\"0\"><cn id=\"'.$id.'\" >';\n }\n\n foreach ($this->_contactMapping as $k => $v) {\n if ($k <> '' && $v <> '') {\n\n // ActiveSync to Zimbra\n if (strrpos($v,',') === false) {\n if($k == 'birthday' || $k == 'anniversary') {\n // Some older android clients have issues with birthday sync causing constant loops - config setting allows for disabling it\n if (($k == 'birthday') && ($this->_disableBirthdaySync)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->GetMessage(): ' . \"ZIMBRA_DISABLE_BIRTHDAY_SYNC set to true - SKIP BIRTHDAY\" );\n } elseif (isset($input->$k)) {\n\t\t\t\t\t\t\t\t\t$inDate = $this->Date4Zimbra($input->$k, \"UTC\");\n if (substr($inDate,9,6) != \"000000\") {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Birthday/Anniversary received from device is NOT in UTC - try Local Timezone' );\n // This does not appear to be a UTC formatted date - so convert based on best guess timezone\n $inDate = $this->Date4Zimbra($input->$k, $this->_tz);\n if (substr($inDate,9,6) != \"000000\") {\n // This does not appear to be a Current TimeZone formatted date - Accept it and Log a warning\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Birthday/Anniversary received from device is NOT in Local Timezone either - Converted as Local Timezone so day may shift !' );\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Birthday/Anniversary received from device APPEARS TO BE in Local Timezone either - Converted as Local Timezone !' );\n }\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Birthday/Anniversary received from device in UTC - Converted as UTC !' );\n }\n $inDate = substr($inDate,0,4).'-'.substr($inDate,4,2).'-'.substr($inDate,6,2);\n $soap .= '<a n=\"'.$v.'\">'.$inDate.'</a>';\n }\n } else if ($k == 'picture' && defined('ZIMBRA_SYNC_CONTACT_PICTURES') && ZIMBRA_SYNC_CONTACT_PICTURES == true && isset($input->$k) && strlen($input->$k) > 0 ) {\n $server_token = $this->UploadToZimbra($input->$k);\n $soap .= '<a n=\"'.$v.'\" aid=\"'.$server_token.'\" />';\n } else if($k == 'children') {\n\n if(isset($input->$k)){\n\t\t\t\t\t\t\t\t\t$children = implode(\",\",$input->$k);\n\n\t\t\t\t\t\t\t\t\t$soap .= '<a n=\"'.$v.'\">'.htmlspecialchars($children).'</a>';\n } else {\n $soap .= '<a n=\"'.$v.'\"/>';\n }\n\t\t\t\t\t\t\t\n } else if($k == 'body') {\n\n\t\t\t\t\t\t\t\t// Normally we would expect the 'body' field to be populated on the incoming contact if there any notes\n\t\t\t\t\t\t\t\t// However, if there are non-standard characters contained in the notes on the device, it seems that \n\t\t\t\t\t\t\t\t// the body field is blank, and an additional field 'rtf' (an rtf encoded notes field) is sent across\n\t\t\t\t\t\t\t\t// instead. We will look for a 'body' field first and only if we don't find it look for an 'rtf' field\n\n\n $notes = \"\";\n $notesType = 1;\n if ((Request::GetProtocolVersion() >= 12)) {\n if (isset($input->asbody->data)) {\n \t\t\t\tif (is_resource($input->asbody->data)) {\n $notes = stream_get_contents($input->asbody->data);\n fclose($input->asbody->data);\n $notesType = $input->asbody->type;\n } else {\n $notes = $input->asbody->data;\n $notesType = $input->asbody->type;\n }\n }\n } else if ((Request::GetProtocolVersion() < 12) && isset($input->body) && ($input->body != \"\")) {\n $notes = $input->body;\n } else if(isset($input->rtf)) {\n if (class_exists('rtf', false)) {\n // start decode RTF if present\n $rtf_body = new rtf ();\n $rtf_body->loadrtf(base64_decode($input->rtf));\n $rtf_body->output(\"ascii\");\n $rtf_body->parse();\n $notes = w2ui( $rtf_body->out );\n unset( $rtf_body );\n } else {\n $notes = \"Missing include file z_RTF.php needed to Decode Notes\";\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'RTF field could not be handled - '.$notes.' - See notes in zimbra.php' );\n }\n }\n\n if ($notes <> \"\") { // Notes changed\n //plain text body unless type = 2 passed in.\n if ($notesType == 1) { \n $soap .= '<a n=\"'.$v.'\">'.htmlspecialchars($notes).'</a>';\n } else {\n $soap .= '<a n=\"'.$v.'\">'.htmlspecialchars($notes).'</a>';\n }\n } else {\n if (isset($originalPlainNotes)) {\n $soap .= '<a n=\"'.$v.'\">'.$originalPlainNotes.'</a>';\n } elseif (isset($originalHtmlNotes)) {\n $soap .= '<a n=\"'.$v.'\">'.$originalHtmlNotes.'</a>';\n }\n }\n } else if (($k == 'email1address') || ($k == 'email2address') || ($k == 'email3address')) {\n\n\t\t\t\t\t\t\t\t// Android sends the Name along with the email address. Use the RFC822 parser to strip it\n if(isset($input->$k)){\nZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Email Address ['.$input->$k.']' );\n $parser = new Mail_RFC822();\n $emailAddr = $this->parseAddr($parser->parseAddressList($input->$k));\n\t\t\t\t\t unset($parser);\nZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Email Address ['.$emailAddr.']' );\n $soap .= '<a n=\"'.$v.'\">'.htmlspecialchars($emailAddr).'</a>';\n } else {\n $soap .= '<a n=\"'.$v.'\"/>';\n }\n } else {\n if(isset($input->$k)){\n $soap .= '<a n=\"'.$v.'\">'.htmlspecialchars($input->$k).'</a>';\n } else {\n $soap .= '<a n=\"'.$v.'\"/>';\n }\n }\n\n } else {\nZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'v has a comma' );\n\t\t\t\t\t\t// TODO - I may need to revisit this as I'm not sure this is working as intended. May need to record somewhere\n // which field in zimbra is mapped to the ActiveSync field.\n if(isset($input->$k)){\n $v_vals = explode(\",\",$v);\n foreach ($v_vals as $v_val) {\n $soap .= '<a n=\"'.$v_val.'\">'.$input->$k.'</a>';\n\t\t\t\t\t\t\t\t}\n unset( $v_vals );\n unset( $v_val );\n }\n }\n }\n }\n unset( $k );\n unset( $v );\n\n if($id == '') {\n $soap .= '</cn></CreateContactRequest>';\n } else {\n $soap .= '</cn></ModifyContactRequest>';\n }\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n if($response) {\n if ($id == '') {\n $array = json_decode($response, true);\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'CreateContact:' . print_r( $array, true ) );\n unset($response);\n $id = $array['Body']['CreateContactResponse']['cn'][0]['id'];\n\t\t\t\t\t\tunset($array);\n } else {\n // Modifying existing contact - Cannot apply TAGS to shared items - so don't even try\n// if (strrpos($id,':') === false) {\n if ('ME' == $idOwner) {\n $soap ='<ContactActionRequest xmlns=\"urn:zimbraMail\">\n <action id=\"'.$id.'\" op=\"update\" t=\"'.$inputtags.'\" />\n </ContactActionRequest> ';\n $returnJSON = true;\n $actionResponse = $this->SoapRequest($soap, false, false, $returnJSON);\n if($actionResponse) {\n $actionArray = json_decode($actionResponse, true);\n if (!isset($actionArray['Body']['ContactActionResponse']['action']['id']) or !isset($actionArray['Body']['ContactActionResponse']['action']['op'])) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ChangeMessage CONTACT TAG update failed');\n }\n }\n unset($actionResponse);\n }\n }\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage CONTACT { true }');\n return $this->StatMessage($this->_folders[$index]->devid, $id);\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage CONTACT { false }');\n return false;\n }\n break;\n\n case 'appointment':\n\n// ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: ' . print_r( $input, true ), false );\n\n if (!$contentParameters) {\n // For z-push 2 releases 2.0.7 and earlier Content Parameters are not being set before the call to ChangeMessage\n // Set it here to prevent GetMessage from crashing with the following message\n // PHP Fatal error: Call to a member function GetContentClass() on a non-object\n $contentParameters = new ContentParameters();\n $contentParameters->SetContentClass('appointment');\n// $contentParameters->SetFilterType();\n// $contentParameters->SetRTFTruncation();\n// $contentParameters->SetMimeSupport();\n// $contentParameters->SetMimeTruncation();\n $bodyPreference = new BodyPreference();\n $bodyPrefArray = array();\n $bodyPrefArray[1] = $bodyPreference;\n\n $contentParameters->bodypref = $bodyPrefArray;\n }\n\n\n// if (isset($input->categories) and (trim($input->categories) != \"\")) {\n/*\n if (isset($input->categories) and is_array($input->categories)) {\n $apptTagIds = $this->CategoriesToTags($input->categories);\n\t\t\t\t\n $appttags = implode( \",\",$apptTagIds);\n $tagattribute = ' t=\"'.$appttags.'\" ';\n } else {\n $appttags = \"\";\n $tagattribute = \"\";\n }\n*/\n\n $zimbraStrippedExceptions = false;\n if($id == '') {\n\n if ($this->_serverInviteReply) {\n $soap = '<CreateAppointmentRequest xmlns=\"urn:zimbraMail\"><m l=\"'.$zimbraFolderId.'\" '.$inputattribute.' d=\"'.$input->dtstamp.'000\">';\n } else {\n $soap = '<SetAppointmentRequest xmlns=\"urn:zimbraMail\" l=\"'.$zimbraFolderId.'\" '.$inputattribute.'><default><m>';\n }\n } else {\n $preModAppt = $this->GetMessage($folderid, $id, $contentParameters); \n// ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'GetApptReq Original Appt: ' . print_r( $preModAppt, true ), false );\n\n if (!isset($input->timezone)) {\n $input->timezone = $preModAppt->timezone;\n }\n if (!isset($input->dtstamp) || ($input->dtstamp == 0)) {\n $input->dtstamp = $preModAppt->dtstamp;\n }\n if (!isset($input->starttime)) {\n $input->starttime = $preModAppt->starttime;\n }\n if (!isset($input->endtime)) {\n $input->endtime = $preModAppt->endtime;\n }\n\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Checking if changes mean exceptions need to be stripped ! ' );\n if (isset($input->recurrence) && !isset($preModAppt->recurrence)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence - does not exist on original ' );\n $zimbraStrippedExceptions = true;\n } elseif (!isset($input->recurrence) && isset($preModAppt->recurrence)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: no recurrence - Original does' );\n $zimbraStrippedExceptions = true;\n } elseif ($input->starttime != $preModAppt->starttime) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: starttime changed' );\n $zimbraStrippedExceptions = true;\n } elseif ($input->endtime != $preModAppt->endtime) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: endtime changed' );\n $zimbraStrippedExceptions = true;\n }\n\t\t\t\t\t\n if (isset($input->recurrence) && isset($preModAppt->recurrence)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence exists on both - Checking for/correcting known issues with patterns' );\n\n if (!isset($input->recurrence->until) && !isset($preModAppt->recurrence->until) && !isset($input->recurrence->occurrences) && isset($preModAppt->recurrence->occurrences)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence exists on both - Replacing empty input occurrences with preModAppt occurrences ' );\n\n // Android not sending back occurrences - hack to fix it\n $input->recurrence->occurrences = $preModAppt->recurrence->occurrences;\n }\n\n if (!isset($input->recurrence->interval) && isset($preModAppt->recurrence->interval) && ($preModAppt->recurrence->interval == 1)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence exists on both - Interval OMITTED on input but set to 1 on preModAppt - Adding interval = 1 to input to avoid stripping exceptions ' );\n\n // Some devices do not supply the default (1) value for interval\n $input->recurrence->interval = $preModAppt->recurrence->interval;\n }\n\n if (isset($input->recurrence->interval) && isset($preModAppt->recurrence->interval) && ($input->recurrence->interval == $preModAppt->recurrence->interval)) {\n if (isset($input->recurrence->dayofweek) && isset($preModAppt->recurrence->dayofweek) && ($input->recurrence->dayofweek == $preModAppt->recurrence->dayofweek)) {\n if (isset($input->recurrence->type) && isset($preModAppt->recurrence->type) && ($input->recurrence->type == 1) && ($preModAppt->recurrence->type == 0)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence exists on both - Interval & DayOfWeek MATCH - Replacing input Type 1 with preModAppt Type 0 to prevent stripping Exceptions from device \"corrected\" pattern ' );\n\n // Apple \"corrects\" the type for these appointments - hack to fix it so that zimbra will not treat it as a change of recurrence pattern\n // These come about when recurrence is set up as Daily in zimbra then customized to be Weekdays only. They should actually be weekly (type==1).\n $input->recurrence->type = $preModAppt->recurrence->type;\n }\n }\n if (isset($input->recurrence->type) && isset($preModAppt->recurrence->type) && ($input->recurrence->type == 0) && ($preModAppt->recurrence->type == 0)) {\n if (!isset($input->recurrence->dayofweek) && isset($preModAppt->recurrence->dayofweek)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence exists on both - Interval & Type(0) MATCH - Replacing input DayOfWeek with preModAppt DayOfWeek to prevent stripping Exceptions from device \"corrected\" pattern ' );\n\n // Android \"corrects\" the DayOfWeek (by dropping it) for these appointments - hack to fix it so that zimbra will not treat it as a change of recurrence pattern\n // These come about when recurrence is set up as Daily in zimbra then customized to be Weekdays only. They should actually be weekly (type==1)\n $input->recurrence->dayofweek = $preModAppt->recurrence->dayofweek;\n }\n }\n }\n\n if (isset($input->recurrence->until) && isset($preModAppt->recurrence->until) && ($input->recurrence->until != $preModAppt->recurrence->until)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence exists on both - Until date changed on input - was ['.$preModAppt->recurrence->until.'] - now ['.$input->recurrence->until.'] ' );\n\n $msDifference = $preModAppt->recurrence->until - $input->recurrence->until;\n if (($msDifference > 0) && ($msDifference < 86400)) { \n // Android not sending back time in Until field, it just sends the date - hack to fix it by keeping the original Until time. This avoids zimbra stripping the exceptions. \n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence Until changed by less than a full day ('.$msDifference.' secs.) Assuming android has dropped the time - Replacing input Until with preModAppt Until ' );\n $input->recurrence->until = $preModAppt->recurrence->until;\n }\n }\n\n if (isset($input->recurrence->type) && isset($preModAppt->recurrence->type) && ($input->recurrence->type == 1) && ($preModAppt->recurrence->type == 1) && isset($preModAppt->recurrence->premodtype) && ($preModAppt->recurrence->premodtype == 0)) {\n // Override type back to 0 to match zimbra original. This is to avoid stripping exceptions\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence type 1 whereas ZIMRA original appointment is DAI (type 0) - Replacing input type with preModAppt->premodtype (0) ' );\n $preModAppt->recurrence->type = 0;\n $input->recurrence->type = 0;\n // $preModAppt->recurrence->premodtype is no longer needed - remove it to prevent breaking the comparison\n unset( $preModAppt->recurrence->premodtype );\n }\nif (is_string($input->recurrence->occurrences)) { ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input->recurrence->occurrences is a STRING'); }\nif (is_integer($input->recurrence->occurrences)) { ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input->recurrence->occurrences is an INTEGER'); }\nif (is_string($preModAppt->recurrence->occurrences)) { ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'preModAppt->recurrence->occurrences is a STRING'); }\nif (is_integer($preModAppt->recurrence->occurrences)) { ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'preModAppt->recurrence->occurrences is an INTEGER'); }\n\n }\n if (isset($input->recurrence) && !$input->recurrence->equals( $preModAppt->recurrence )) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Input Appt: recurrence changed' );\n $zimbraStrippedExceptions = true;\n }\n if ($zimbraStrippedExceptions) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Exceptions will be stripped by zimbra ! ' );\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Exceptions will NOT be stripped by zimbra ! ' );\n }\n\n $invId = $preModAppt->zimbraInvId;\n\n $soap = '<ModifyAppointmentRequest xmlns=\"urn:zimbraMail\" ms=\"'.$preModAppt->zimbraMs.'\" rev=\"'.$preModAppt->zimbraRev.'\" id=\"'.$invId.'\" comp=\"0\">';\n $soap .= '<m l=\"'.$preModAppt->folderid.'\">';\n }\n\n $tzName = false;\n\n if(isset($input->timezone)) {\n $tzObject = $this->GetTZFromSyncBlob(base64_decode($input->timezone));\n// ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'incoming tzObject: '. print_r( $tzObject, true ) );\n\n $dstoffset = -60*(intval($tzObject['bias'])+intval($tzObject['dstbias']));\n $stdoffset = -60*(intval($tzObject['bias'])+intval($tzObject['stdbias']));\n\n if (($dstoffset != $stdoffset) && function_exists(\"timezone_name_from_abbr\")) {\n $tzName = timezone_name_from_abbr(\"\", $dstoffset, 1); // DST - Most accurate\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Matched Timezone from timezone_name_from_abbr using DST [' . $tzName . '] ' );\n } else {\n if (function_exists(\"timezone_abbreviations_list\")) {\n $timezone_abbreviations = timezone_abbreviations_list();\n $possibleMatches = array();\n\n while ($region = each($timezone_abbreviations) ) {\n\n $count = sizeof($region['value']);\n for ($i=0;$i < $count;$i++) {\n $tzListItem = $region['value'][$i];\n if (($tzListItem['dst'] === false) && ( $tzListItem['offset'] == $stdoffset )) {\n $possibleMatches[$tzListItem['timezone_id']]['std'] = 1; \n }\n }\n for ($i=0;$i < $count;$i++) {\n $tzListItem = $region['value'][$i];\n if (($tzListItem['dst'] === true) && ( $tzListItem['offset'] == $dstoffset )) {\n if (in_array( $tzListItem['timezone_id'], $possibleMatches )) {\n $possibleMatches[$tzListItem['timezone_id']]['dst'] = 1; \n } else {\n $possibleMatches[$tzListItem['timezone_id']]['std'] = 0; \n $possibleMatches[$tzListItem['timezone_id']]['dst'] = 1; \n }\n }\n }\n }\n\n if (sizeof($possibleMatches) == 0) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Incoming tzObject Timezone could not be identified: '. print_r( $tzObject, true ) );\n }\n\n if ($dstoffset == $stdoffset) {\n foreach($possibleMatches as $name => $possibleMatch) {\n if (($possibleMatch['std'] == 1) && (!isset($possibleMatch['dst']))) {\n $tzName = $name;\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Matched Timezone with STD-only timezone [' . $tzName . '] ' );\n break;\n }\n }\n } else {\n foreach($possibleMatches as $name => $possibleMatch) {\n if (($possibleMatch['std'] == 1) && (isset($possibleMatch['dst']))&& ($possibleMatch['dst'] == 1)) {\n $tzName = $name;\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Matched Timezone with STD-DST timezone [' . $tzName . '] ' );\n break;\n }\n }\n }\n }\n }\n }\n if (!$tzName) {\n $tzName = $this->_tz; // Best guess is User Preferred TZ\n }\n\n $soap .= '<inv';\n if ($id != '') {\n $soap .= ' uid=\"'.$preModAppt->uid.'\" ><comp ';\n } else {\n $soap .= '><comp ';\n\n // if creating a new appointment, and a UID is passed from the phone - Use it\n if (isset($input->uid)) {\n $soap .='uid=\"'.$input->uid.'\" ';\n }\n }\n\n if($id == '') {\n if (!$this->_serverInviteReply) {\n $soap .= ' d=\"'.$input->dtstamp.'000\" ';\n }\n }\n\n // If the phone is sending the invite directly, then we need to tell the server that they are sent.\n if (!$this->_serverInviteReply) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Setting neverSent=\"0\"' );\n $soap .= ' neverSent=\"0\" ';\n }\n\n /* Free/Busy Status\n fba=\"F|B|T|O\"\n F => 0\n B => 2\n T => 1\n O => 3 // ?\n */\n if (isset($input->busystatus)) {\n if($input->busystatus == 0) {\n $soap .= 'fb=\"F\" ';\n } else if($input->busystatus == 1) {\n $soap .= 'fb=\"T\" ';\n } else if($input->busystatus == 2) {\n $soap .= 'fb=\"B\" ';\n } else if($input->busystatus == 3) {\n $soap .= 'fb=\"O\" ';\n }\n } else $soap .= 'fb=\"F\" ';\n\n /* Sensitivity Status\n [class=\"PUB|PRI|CON\"]\n PUB => 0 // Default\n PRI => 1\n CON => 2\n */\n if (isset($input->sensitivity)) {\n if($input->sensitivity == 0) {\n $soap .= 'class=\"PUB\" ';\n } else if($input->sensitivity == 1) {\n $soap .= 'class=\"PRI\" ';\n } else if($input->sensitivity == 2) {\n $soap .= 'class=\"CON\" ';\n }\n } else $soap .= 'class=\"PUB\" ';\n\n\n // allday\n if ((isset($input->alldayevent)) && ($input->alldayevent == 1)) {\n $soap .= 'allDay=\"1\" ';\n } else {\n $soap .= 'allDay=\"0\" ';\n } \n\n // subject\n if(isset($input->subject)) {\n $soap .= 'name=\"'.htmlspecialchars($input->subject).'\" ';\n }\n\n // location\n if(isset($input->location)) {\n $soap .= 'loc=\"'.htmlspecialchars($input->location).'\" ';\n }\n\n // close <comp ... >\n $soap .= '> ';\n\n if ((isset($input->alldayevent)) && ($input->alldayevent == 1)) {\n \t\n\t //starttime\n\t $starttime = $this->Date4Zimbra($input->starttime, $tzName);\n\t $starttime = substr( $starttime, 0, 8);\n\t $soap .= '<s d=\"'.$starttime.'\"/> ';\n\n\t //endtime\n\t // As Zimbra stores both start and end as the same date (unlike ActiveSync) we need to subtract 1 day\n\t $endtime = $this->Date4Zimbra($input->endtime - 86400, $tzName);\n\t $endtime = substr( $endtime, 0, 8 );\n\t $soap .= '<e d=\"'.$endtime.'\"/> ';\n } else {\n\n if ($this->_zimbraVersion == '5.0' ) {\n $v5tz = $this->LookupV5Timezone( $tzName, \"\");\n if ($v5tz !== false) {\n $v5tzAttribute = ' tz=\"'.$v5tz.'\" ';\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . \"Incoming Meeting v6 TimeZone [\".$tzName.\"] NOT FOUND in v5timezone.xml - APPOINTMENT START/END TIMES WILL BE SAVED TO ZIMBRA WITH NO SET TIMEZONE\" );\n $v5tzAttribute = '';\n }\n\n //starttime\n $soap .= '<s '.$v5tzAttribute.' d=\"'.$this->Date4Zimbra($input->starttime, $tzName).'\"/> ';\n\n //endtime\n $soap .= '<e '.$v5tzAttribute.' d=\"'.$this->Date4Zimbra($input->endtime, $tzName).'\"/> ';\n } else {\n\t\t\t\t\t\t//starttime\n\t\t\t\t\t\t$soap .= '<s tz=\"'.$tzName.'\" d=\"'.$this->Date4Zimbra($input->starttime, $tzName).'\"/> ';\n\t\t\t\t\t\n\t\t\t\t\t\t//endtime\n\t\t\t\t\t\t$soap .= '<e tz=\"'.$tzName.'\" d=\"'.$this->Date4Zimbra($input->endtime, $tzName).'\"/> ';\n }\n } \n\n if($id == '') {\n if (($folderOwner != 'ME') && ($zimbraFolderOwner <> '')) {\n $soap .= '<or a=\"'.$zimbraFolderOwner.'\" /> ';\n } else {\n $soap .= '<or a=\"'.$this->_sendAsEmail.'\" d=\"'.$this->_sendAsName.'\"/> ';\n }\n } else {\n //organizer - R47 - don't change if updating an existing appointment\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Modifying Appointment - Attempting to keep saved Organizer ['.$preModAppt->premodorganizername.'] - Email ['.$preModAppt->premodorganizeremail.']' );\n\n if (isset($preModAppt->premodorganizeremail) && (trim($preModAppt->premodorganizeremail) != \"\")) {\n $soap .= '<or a=\"'.$preModAppt->premodorganizeremail.'\" ';\n if (isset($preModAppt->premodorganizername) && (trim($preModAppt->premodorganizername) != \"\")) {\n $soap .= ' d=\"'.$preModAppt->premodorganizername.'\" ';\n }\n $soap .= ' /> ';\n }\n }\n \n //attendees\n unset( $attendees );\n if(isset($input->attendees)) {\n $attendees = $input->attendees;\n } elseif(isset($preModAppt->attendees)) {\n $attendees = $preModAppt->attendees;\n }\n if (isset($attendees)) {\n foreach($attendees as $attendee) {\n if (isset($attendee->email)) {\n $soap .= '<at a=\"'.$attendee->email.'\" ';\n if (isset($attendee->name)) {\n $soap .= ' d=\"'.$attendee->name.'\" ';\n }\n\n if(isset($attendee->type) && $attendee->type == 2) {\n $soap .= 'role=\"OPT\" ';\n } else {\n $soap .= 'role=\"REQ\" ';\n }\n $soap .= 'ptst=\"NE\" rsvp=\"1\" />';\n }\n }\n unset( $attendees );\n unset( $attendee );\n }\n\n //recurrence\n if(isset($input->recurrence)) {\n $recurrence = $input->recurrence;\n $soap .= '<recur><add>';\n\n /* SEC,MIN,HOU,DAI,WEE,MON,YEA\n DAI => 0\n WEE => 1\n MON => 2 or 3\n YEA => 5 or 6 (What does 4 mean?)\n */\n if($recurrence->type == 0) {\n $soap .= '<rule freq=\"DAI\">';\n } elseif($recurrence->type == 1) {\n $soap .= '<rule freq=\"WEE\">';\n } elseif( $recurrence->type == 2 || $recurrence->type == 3) {\n $soap .= '<rule freq=\"MON\">';\n } elseif($recurrence->type == 5 || $recurrence->type == 6) {\n $soap .= '<rule freq=\"YEA\">';\n }\n\n // Swapped these around, as spec says use occurrences in preference to until\n if(isset($recurrence->occurrences)) {\n $soap .= '<count num=\"'.$recurrence->occurrences.'\"/>';\n } else if(isset($recurrence->until)) {\n $soap .= '<until d=\"'.$this->Date4Zimbra($recurrence->until, $tzName).'\"/>'; \n }\n\n if(isset($recurrence->interval)) {\n $soap .= '<interval ival=\"'.$recurrence->interval.'\"/>';\n }\n\n if(isset($recurrence->dayofweek)) {\n $soap .= '<byday>';\n // SU\n if($this->GetBit($recurrence->dayofweek, 1)) {\n $soap .= '<wkday day=\"SU\"/>';\n }\n // MO\n if($this->GetBit($recurrence->dayofweek, 2)) {\n $soap .= '<wkday day=\"MO\"/>';\n }\n // TU\n if($this->GetBit($recurrence->dayofweek, 3)) {\n $soap .= '<wkday day=\"TU\"/>';\n }\n // WE\n if($this->GetBit($recurrence->dayofweek, 4)) {\n $soap .= '<wkday day=\"WE\"/>';\n }\n // TH\n if($this->GetBit($recurrence->dayofweek, 5)) {\n $soap .= '<wkday day=\"TH\"/>';\n }\n // FR\n if($this->GetBit($recurrence->dayofweek, 6)) {\n $soap .= '<wkday day=\"FR\"/>';\n }\n // SA\n if($this->GetBit($recurrence->dayofweek, 7)) {\n $soap .= '<wkday day=\"SA\"/>';\n }\n $soap .= '</byday>';\n }\n\n if(isset($recurrence->dayofmonth)) {\n $soap .= '<bymonthday modaylist=\"'.$recurrence->dayofmonth.'\"/>';\n }\n\n if(isset($recurrence->weekofmonth)) {\n // Activesync uses weekofmonth 5 for last week - zimbra uses -1\n if ($recurrence->weekofmonth == 5) {\n $soap .= '<bysetpos poslist=\"-1\"/>';\n } else {\n $soap .= '<bysetpos poslist=\"'.$recurrence->weekofmonth.'\"/>';\n }\n }\n\n if(isset($recurrence->monthofyear)) {\n $soap .= '<bymonth molist=\"'.$recurrence->monthofyear.'\"/>';\n }\n $soap .= '</rule></add></recur>';\n }\n\n if(isset($input->reminder)){\n $soap .='<alarm action=\"DISPLAY\">\n <trigger>\n <rel neg=\"1\" m=\"'.$input->reminder.'\" related=\"START\"/>\n </trigger>\n </alarm> ';\n }\n\n // CLIENT UID\n if (isset($input->uid)) {\n $soap .='<xprop name=\"X-CLIENT-UID\" value=\"'.base64_encode($input->uid).'\"/>';\n }\n\t\t\t\t\n // end <comp> & <inv>\n $soap .= '</comp></inv>';\n\n\n // email organizer/attendees only if _serverInviteReply is set to true\n // Almost all phones now properly send the invites directly themselves\n if ($this->_serverInviteReply) {\n unset( $attendees );\n if(isset($input->attendees)) {\n $attendees = $input->attendees;\n } elseif(isset($preModAppt->attendees)) {\n $attendees = $preModAppt->attendees;\n }\n if (isset($attendees)) {\n foreach($attendees as $attendee) {\n if (isset($attendee->email)) {\n $soap .= '<e a=\"'.$attendee->email.'\" ';\n if (isset($attendee->name)) {\n $soap .= ' p=\"'.$attendee->name.'\" ';\n }\n $soap .= ' t=\"t\" />';\n }\n }\n unset( $attendees );\n unset( $attendee );\n }\n\n }\n\n // email originator\n if($id == '') {\n $soap .= '<e a=\"'.$this->_sendAsEmail.'\"\n p=\"'.$this->_sendAsName.'\" t=\"f\" />';\n } else {\n //organizer - R47 - don't change if updating an existing appointment\n// $soap .= '<e a=\"'.$preModAppt->organizeremail.'\"\n// p=\"'.$preModAppt->organizername.'\" t=\"f\" />';\n if (isset($preModAppt->premodorganizeremail) && (trim($preModAppt->premodorganizeremail) != \"\")) {\n $soap .= '<e a=\"'.$preModAppt->premodorganizeremail.'\" ';\n if (isset($preModAppt->premodorganizername) && (trim($preModAppt->premodorganizername) != \"\")) {\n $soap .= ' p=\"'.$preModAppt->premodorganizername.'\" ';\n }\n $soap .= ' t=\"f\" /> ';\n }\n }\n\n //subject\n $soap .= '<su>'.htmlspecialchars($input->subject).'</su>';\n\n $notes = \"\";\n $notesType = 1;\n if ((Request::GetProtocolVersion() >= 12)) {\n if (isset($input->asbody->data)) {\n if (is_resource($input->asbody->data)) {\n $notes = stream_get_contents($input->asbody->data);\n fclose($input->asbody->data);\n $notesType = $input->asbody->type;\n } else {\n $notes = $input->asbody->data;\n $notesType = $input->asbody->type;\n }\n }\n\n } else if ((Request::GetProtocolVersion() < 12) && isset($input->body) && ($input->body != \"\")) {\n $notes = $input->body;\n } else if(isset($input->rtf)) {\n if (class_exists('rtf', false)) {\n // start decode RTF if present\n $rtf_body = new rtf ();\n $rtf_body->loadrtf(base64_decode($input->rtf));\n $rtf_body->output(\"ascii\");\n $rtf_body->parse();\n $notes = w2ui( $rtf_body->out );\n unset( $rtf_body );\n } else {\n $notes = \"Missing include file z_RTF.php needed to Decode Notes\";\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'RTF field could not be handled - '.$notes.' - See notes in zimbra.php' );\n }\n }\n\n if ($notes <> \"\") { // Notes changed\n //plain text body unless type = 2 passed in.\n if ($notesType == 1) { \n $soap .= '<mp ct=\"text/plain\"><content>'.htmlspecialchars($notes).'</content></mp>';\n } else {\n $soap .= '<mp ct=\"text/html\"><content>'.htmlspecialchars($notes).'</content></mp>';\n }\n } else {\n if (isset($preModAppt->zimbraPlainNotes)) {\n $soap .= '<mp ct=\"text/plain\"><content>'.htmlspecialchars($preModAppt->zimbraPlainNotes).'</content></mp>';\n } elseif (isset($preModAppt->zimbraHtmlNotes)) {\n $soap .= '<mp ct=\"text/html\"><content>'.htmlspecialchars($preModAppt->zimbraHtmlNotes).'</content></mp>';\n }\n }\n\n //close <m>\n $soap .= '</m>';\n\n if($id == '') {\n if ($this->_serverInviteReply) {\n $soap .= '</CreateAppointmentRequest>';\n } else {\n $soap .= '</default></SetAppointmentRequest>';\n }\n } else {\n $soap .= '</ModifyAppointmentRequest>';\n }\n//ZLog::Write(LOGLEVEL_DEBUG, 'Call SOAP' );\n//ZLog::Write(LOGLEVEL_DEBUG, 'SOAP: '.$soap );\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n if($response) {\n $array = json_decode($response, true);\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'CreateUpdateBaseAppt:' . print_r( $array, true ) );\n unset($response);\n if ($id == '') {\n if ($this->_serverInviteReply) {\n $id = $array['Body']['CreateAppointmentResponse']['calItemId'];\n } else {\n $id = $array['Body']['SetAppointmentResponse']['calItemId'];\n }\n \n\t\t\t\t\t\tunset($array);\n } else {\n if (isset($array['Body']['ModifyAppointmentResponse']['ms'])) {\n $preModAppt->zimbraMs = $array['Body']['ModifyAppointmentResponse']['ms'];\n }\n if (isset($array['Body']['ModifyAppointmentResponse']['rev'])) {\n $preModAppt->zimbraRev = $array['Body']['ModifyAppointmentResponse']['rev'];\n }\n // Modifying existing appointment - Cannot apply TAGS to shared items - so don't even try\n if (strrpos($id,':') === false) {\n $soap ='<ItemActionRequest xmlns=\"urn:zimbraMail\">\n <action id=\"'.$id.'\" op=\"update\" t=\"'.$inputtags.'\" />\n </ItemActionRequest> ';\n $actionResponse = $this->SoapRequest($soap, false, false, $returnJSON);\n if($actionResponse) {\n $actionArray = json_decode($actionResponse, true);\n if (!isset($actionArray['Body']['ItemActionResponse']['action']['id']) or !isset($actionArray['Body']['ItemActionResponse']['action']['op'])) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ChangeMessage APPOINTMENT TAG update failed');\n }\n }\n unset($actionResponse);\n }\n }\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { true }');\n// return $this->StatMessage($this->_folders[$index]->devid, $id);\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'SOAP ['.$soap.']' );\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { false }');\n return false;\n }\n\n if (!isset($preModAppt) || $zimbraStrippedExceptions || (!isset($input->exceptions) && !isset($preModAppt->exceptions))) { // zimbra strips exceptions automatically in this case\n return $this->StatMessage($this->_folders[$index]->devid, $id);\n }\n\n /* Base appointment updated !\n Now try to handle exceptions - Adds/Changes/Deletions\n */\n\n // First make sure exceptions exists on both appointments - create empty array if necessary\n if (!isset($input->exceptions)) {\n $input->exceptions = array();\n }\n if (!isset($preModAppt->exceptions)) {\n $preModAppt->exceptions = array();\n }\n\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Appt has/had exceptions - Need to check if they changed ...' );\n\n $except = new SyncAppointmentException();\n $preModExcept = new SyncAppointmentException();\n\n foreach ($input->exceptions as $i=>$except) {\n $matchFound = false;\n foreach ($preModAppt->exceptions as $j=>$preModExcept) {\n \n if ($except->exceptionstarttime == $preModExcept->exceptionstarttime) {\n $matchFound = true;\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Input Except I ['.$i.'] ExceptionStartTime matches PreModExcept J ['.$j.'] at ['.$preModExcept->exceptionstarttime.']' );\n\n // Allow for common differences in the objects ...\n if (!isset($except->meetingstatus) && isset($preModExcept->meetingstatus)) { $except->meetingstatus = $preModExcept->meetingstatus; }\n if (!isset($except->dtstamp) && isset($preModExcept->dtstamp)) { $except->dtstamp = $preModExcept->dtstamp; }\n if ((isset($except->dtstamp) && isset($preModExcept->dtstamp)) && ($except->dtstamp != $preModExcept->dtstamp)) {\nZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): dtstamp values are different - PreMod [' . $preModExcept->dtstamp . '] - Input [ ' . $except->dtstamp . '] - Oerwriting incoming one to avoid being the cause of a difference' );\n $except->dtstamp = $preModExcept->dtstamp;\n }\n if (isset($except->deleted) && !isset($preModExcept->deleted) && ($except->deleted == 0)) { $preModExcept->deleted = 0; }\n if (!isset($except->deleted) && isset($preModExcept->deleted) && ($preModExcept->deleted == 0)) { $except->deleted = 0; }\n if (isset($except->sensitivity) && !isset($preModExcept->sensitivity) && ($except->sensitivity == 0)) { $preModExcept->sensitivity = 0; }\n if (!isset($except->sensitivity) && isset($preModExcept->sensitivity) && ($preModExcept->sensitivity == 0)) { $except->sensitivity = 0; }\n if (isset($except->asbody) && isset($preModExcept->asbody)) {\nZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Both have asbody' );\n if (isset($except->asbody->type) && isset($preModExcept->asbody->type) && ($except->asbody->type == $preModExcept->asbody->type)) {\nZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Both have asbody->type and they match' );\n if (isset($except->asbody->data) && isset($preModExcept->asbody->data) && is_resource($except->asbody->data) && is_resource($preModExcept->asbody->data)) {\nZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Both have asbody->data and they are resources' );\n $except->asbody->streamtext = str_replace( \"\\r\\n\", \"\\n\", stream_get_contents($except->asbody->data));\n fclose($except->asbody->data);\n $except->asbody->data = null;\n $preModExcept->asbody->streamtext = str_replace( \"\\r\\n\", \"\\n\", stream_get_contents($preModExcept->asbody->data));\n fclose($preModExcept->asbody->data);\n $preModExcept->asbody->data = null;\n if (trim($preModExcept->asbody->streamtext) == trim($except->asbody->streamtext)) {\n $except->asbody->streamtext = $preModExcept->asbody->streamtext;\n $except->asbody->estimatedDataSize = $preModExcept->asbody->estimatedDataSize = strlen($preModExcept->asbody->streamtext);\nZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Both have asbody->data and they are the SAME' );\n } else {\nZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Both have asbody->data and they are DIFFERENT' );\n }\n } elseif (isset($except->asbody->data) && isset($preModExcept->asbody->data) && (!is_resource($except->asbody->data)) && (!is_resource($preModExcept->asbody->data)) && (trim(str_replace( \"\\r\\n\", \"\\n\", $except->asbody->data)) == trim(str_replace( \"\\r\\n\", \"\\n\", $preModExcept->asbody->data)))) {\n $except->asbody = $preModExcept->asbody;\n }\n\n }\n } elseif (!isset($except->asbody) && isset($preModExcept->asbody)) {\n if (isset($preModExcept->asbody->data) && is_resource($preModExcept->asbody->data)) {\n $preModExcept->asbody->streamtext = str_replace( \"\\r\\n\", \"\\n\", stream_get_contents($preModExcept->asbody->data));\n fclose($preModExcept->asbody->data);\n $preModExcept->asbody->data = null;\n }\n $except->asbody = $preModExcept->asbody;\n }\n\n// ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): PreModExcept->asbody: ' . print_r($preModExcept->asbody ,true), false );\n// ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Except->asbody: ' . print_r($except->asbody ,true), false );\n // Now compare them ...\n if (!$except->equals($preModExcept)) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Input Except I ['.$i.'] DOES NOT match PreModExcept J ['.$j.'] - Need to do mods here' );\n\n // TODO - TO DO - Just duplicating code for the moment to get this working - need to revisit and tidy up.\n\n if (isset($except->categories) and is_array($except->categories)) {\n $apptTagIds = $this->CategoriesToTags($except->categories);\n\t\t\t\t\n $appttags = implode( \",\",$apptTagIds);\n $tagattribute = ' t=\"'.$appttags.'\" ';\n } else {\n $appttags = \"\";\n $tagattribute = \"\";\n }\n\n $invId = $preModExcept->zimbraInvId;\n\n if (isset($except->deleted) && $except->deleted == 1) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Input Except I ['.$i.'] is a new deletion of an existing exception occurrence' );\n\n $soap = '<CancelAppointmentRequest xmlns=\"urn:zimbraMail\" id=\"'.$preModAppt->zimbraInvId.'\" comp=\"'.$preModAppt->zimbraCompNum.'\" >';\n $soap .= '<inst d=\"'.$this->Date4Zimbra($except->exceptionstarttime, $tzName).'\" tz=\"'.$tzName.'\" />';\n $soap .= '</CancelAppointmentRequest>';\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n if($response) {\n $array = json_decode($response, true);\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'CancelAppointmentRequest (Exception):' . print_r( $array, true ) );\n unset($response);\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { true }');\n// return $this->StatMessage($this->_folders[$index]->devid, $id);\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'SOAP ['.$soap.']' );\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { false }');\n return false;\n }\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Input Except I ['.$i.'] is a new modification of an existing exception occurrence' );\n\n $soap = '<ModifyAppointmentRequest xmlns=\"urn:zimbraMail\" id=\"'.$invId.'\" comp=\"0\">';\n $soap .= '<m l=\"'.$zimbraFolderId.'\" >';\n// $soap .= '<inv uid=\"'.$preModAppt->uid.'\"><comp ';\n $soap .= '<inv><comp ';\n\n /* Free/Busy Status\n fba=\"F|B|T|O\"\n F => 0\n B => 2\n T => 1\n O => 3 // ?\n */\n if (!isset($except->busystatus) && isset($preModAppt->busystatus)) { $except->busystatus = $preModAppt->busystatus; } \n if (isset($except->busystatus)) {\n if($except->busystatus == 0) {\n $soap .= 'fb=\"F\" ';\n } else if($except->busystatus == 1) {\n $soap .= 'fb=\"T\" ';\n } else if($except->busystatus == 2) {\n $soap .= 'fb=\"B\" ';\n } else if($except->busystatus == 3) {\n $soap .= 'fb=\"O\" ';\n }\n } else $soap .= 'fb=\"F\" ';\n\n /* Sensitivity Status\n [class=\"PUB|PRI|CON\"]\n PUB => 0 // Default\n PRI => 1\n CON => 2\n */\n if (isset($except->sensitivity)) {\n if($except->sensitivity == 0) {\n $soap .= 'class=\"PUB\" ';\n } else if($except->sensitivity == 1) {\n $soap .= 'class=\"PRI\" ';\n } else if($except->sensitivity == 2) {\n $soap .= 'class=\"CON\" ';\n }\n } else $soap .= 'class=\"PUB\" ';\n\n // allday\n if ((isset($except->alldayevent)) && ($except->alldayevent == 1)) {\n $soap .= 'allDay=\"1\" ';\n } else {\n $soap .= 'allDay=\"0\" ';\n } \n\n // subject\n if(isset($except->subject)) {\n $soap .= 'name=\"'.htmlspecialchars($except->subject).'\" ';\n }\n\n // location\n if(isset($except->location)) {\n $soap .= 'loc=\"'.htmlspecialchars($except->location).'\" ';\n }\n\n // close <comp ... >\n $soap .= '> ';\n\n if ((isset($except->alldayevent)) && ($except->alldayevent == 1)) {\n \t\n \t //starttime\n \t $starttime = $this->Date4Zimbra($except->starttime, $tzName);\n \t $starttime = substr( $starttime, 0, 8);\n\t $soap .= '<s d=\"'.$starttime.'\"/> ';\n\n\t //endtime\n\t // As Zimbra stores both start and end as the same date (unlike ActiveSync) we need to subtract 1 day\n\t $endtime = $this->Date4Zimbra($except->endtime - 86400, $tzName);\n\t $endtime = substr( $endtime, 0, 8 );\n \t $soap .= '<e d=\"'.$endtime.'\"/> ';\n } else {\n\n if ($this->_zimbraVersion == '5.0' ) {\n $v5tz = $this->LookupV5Timezone( $tzName, \"\");\n if ($v5tz !== false) {\n $v5tzAttribute = ' tz=\"'.$v5tz.'\" ';\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . \"Incoming Meeting v6 TimeZone [\".$tzName.\"] NOT FOUND in v5timezone.xml - APPOINTMENT START/END TIMES WILL BE SAVED TO ZIMBRA WITH NO SET TIMEZONE\" );\n $v5tzAttribute = '';\n }\n\n //starttime\n $soap .= '<s '.$v5tzAttribute.' d=\"'.$this->Date4Zimbra($except->starttime, $tzName).'\"/> ';\n\n //endtime\n $soap .= '<e '.$v5tzAttribute.' d=\"'.$this->Date4Zimbra($except->endtime, $tzName).'\"/> ';\n } else {\n \t\t\t\t\t\t//starttime\n \t\t\t\t\t\t$soap .= '<s tz=\"'.$tzName.'\" d=\"'.$this->Date4Zimbra($except->starttime, $tzName).'\"/> ';\n\t\t\t\t\t\n \t\t\t\t\t\t//endtime\n \t\t\t\t\t\t$soap .= '<e tz=\"'.$tzName.'\" d=\"'.$this->Date4Zimbra($except->endtime, $tzName).'\"/> ';\n }\n } \n\n //organizer - R47 - don't change if updating an existing appointment\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Modifying Appointment - Attempting to keep saved Organizer ['.$preModAppt->premodorganizername.'] - Email ['.$preModAppt->premodorganizeremail.']' );\n\n if (isset($preModAppt->premodorganizeremail) && (trim($preModAppt->premodorganizeremail) != \"\")) {\n $soap .= '<or a=\"'.$preModAppt->premodorganizeremail.'\" ';\n if (isset($preModAppt->premodorganizername) && (trim($preModAppt->premodorganizername) != \"\")) {\n $soap .= ' d=\"'.$preModAppt->premodorganizername.'\" ';\n }\n $soap .= ' /> ';\n }\n\n //attendees\n unset( $attendees );\n if(isset($except->attendees)) {\n $attendees = $except->attendees;\n } elseif(isset($preModExcept->attendees)) {\n $attendees = $preModExcept->attendees;\n } elseif(isset($preModAppt->attendees)) {\n $attendees = $preModAppt->attendees;\n }\n if (isset($attendees)) {\n foreach($attendees as $attendee) {\n if (isset($attendee->email)) {\n $soap .= '<at a=\"'.$attendee->email.'\" ';\n if (isset($attendee->name)) {\n $soap .= ' d=\"'.$attendee->name.'\" ';\n }\n\n if(isset($attendee->type) && $attendee->type == 2) {\n $soap .= 'role=\"OPT\" ';\n } else {\n $soap .= 'role=\"REQ\" ';\n }\n $soap .= 'ptst=\"NE\" rsvp=\"1\" />';\n }\n }\n unset( $attendees );\n unset( $attendee );\n }\n\n if(isset($except->reminder)){\n $soap .='<alarm action=\"DISPLAY\">\n <trigger>\n <rel neg=\"1\" m=\"'.$except->reminder.'\" related=\"START\"/>\n </trigger>\n </alarm> ';\n }\n\n // end <comp> & <inv>\n $soap .= '</comp></inv>';\n\n\n // email organizer/attendees only if _serverInviteReply is set to true\n // Almost all phones now properly send the invites directly themselves\n if ($this->_serverInviteReply) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . \"Updating Appointment: _serverInviteReply IS true - so SEND invites from zimbra\");\n if(isset($except->attendees)) {\n $attendees = $except->attendees;\n foreach($attendees as $attendee) {\n if (isset($attendee->email)) {\n $soap .= '<e a=\"'.$attendee->email.'\" ';\n if (isset($attendee->name)) {\n $soap .= ' p=\"'.$attendee->name.'\" ';\n }\n $soap .= ' t=\"t\" />';\n }\n }\n unset( $attendees );\n unset( $attendee );\n }\n\n }\n\n //organizer - R47 - don't change if updating an existing appointment\n $soap .= '<e a=\"'.$preModAppt->organizeremail.'\"\n p=\"'.$preModAppt->organizername.'\" t=\"f\" />';\n\n //subject\n $soap .= '<su>'.htmlspecialchars($except->subject).'</su>';\n\n $notes = \"\";\n $notesType = 1;\n if ((Request::GetProtocolVersion() >= 12)) {\n \t\t\t\tif (isset($except->asbody->streamtext)) {\n $notes = $except->asbody->streamtext;\n $notesType = $except->asbody->type;\n } elseif (isset($except->asbody->data)) {\n $notes = $except->asbody->data;\n $notesType = $except->asbody->type;\n }\n } else if ((Request::GetProtocolVersion() < 12) && isset($except->body) && ($except->body != \"\")) {\n $notes = $except->body;\n } else if(isset($except->rtf)) {\n if (class_exists('rtf', false)) {\n // start decode RTF if present\n $rtf_body = new rtf ();\n $rtf_body->loadrtf(base64_decode($except->rtf));\n $rtf_body->output(\"ascii\");\n $rtf_body->parse();\n $notes = w2ui( $rtf_body->out );\n unset( $rtf_body );\n } else {\n $notes = \"Missing include file z_RTF.php needed to Decode Notes\";\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'RTF field could not be handled - '.$notes.' - See notes in zimbra.php' );\n }\n }\n\n if ($notes <> \"\") { // Notes changed\n //plain text body unless type = 2 passed in.\n if ($notesType == 1) { \n $soap .= '<mp ct=\"text/plain\"><content>'.htmlspecialchars($notes).'</content></mp>';\n } else {\n $soap .= '<mp ct=\"text/html\"><content>'.htmlspecialchars($notes).'</content></mp>';\n }\n } else {\n if (isset($preModAppt->zimbraPlainNotes)) {\n $soap .= '<mp ct=\"text/plain\"><content>'.htmlspecialchars($preModAppt->zimbraPlainNotes).'</content></mp>';\n } elseif (isset($preModAppt->zimbraHtmlNotes)) {\n $soap .= '<mp ct=\"text/html\"><content>'.htmlspecialchars($preModAppt->zimbraHtmlNotes).'</content></mp>';\n }\n }\n\n //close <m>\n $soap .= '</m>';\n\n $soap .= '</ModifyAppointmentRequest>';\n//ZLog::Write(LOGLEVEL_DEBUG, 'Call SOAP' );\n//ZLog::Write(LOGLEVEL_DEBUG, 'SOAP (ModifyAppointmentException): '.$soap );\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n if($response) {\n $array = json_decode($response, true);\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ModApptException:' . print_r( $array, true ) );\n unset($response);\n if (isset($array['Body']['ModifyAppointmentResponse']['ms'])) {\n $preModAppt->zimbraMs = $array['Body']['ModifyAppointmentResponse']['ms'];\n }\n if (isset($array['Body']['ModifyAppointmentResponse']['rev'])) {\n $preModAppt->zimbraRev = $array['Body']['ModifyAppointmentResponse']['rev'];\n }\n // Modifying existing appointment - Cannot apply TAGS to shared items - so don't even try\n if (strrpos($id,':') === false) {\n $soap ='<ItemActionRequest xmlns=\"urn:zimbraMail\">\n <action id=\"'.$id.'\" op=\"update\" t=\"'.$appttags.'\" />\n </ItemActionRequest> ';\n $actionResponse = $this->SoapRequest($soap, false, false, $returnJSON);\n if($actionResponse) {\n $actionArray = json_decode($actionResponse, true);\n if (!isset($actionArray['Body']['ItemActionResponse']['action']['id']) or !isset($actionArray['Body']['ItemActionResponse']['action']['op'])) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ChangeMessage APPOINTMENT TAG update failed');\n }\n }\n unset($actionResponse);\n }\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { true }');\n// return $this->StatMessage($this->_folders[$index]->devid, $id);\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'SOAP ['.$soap.']' );\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { false }');\n return false;\n }\n } \n\n// END duplicating for Modify\n }\n unset( $preModAppt->exceptions[$j] );\n }\n }\n\n if (!$matchFound) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Input Except I ['.$i.'] DOES NOT exist in PreModExcepts - Need to add it here' );\n\n if (isset($except->deleted) && $except->deleted == 1) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Input Except I ['.$i.'] is a new deletion of an occurrence' );\n\n $soap = '<CancelAppointmentRequest xmlns=\"urn:zimbraMail\" id=\"'.$preModAppt->zimbraInvId.'\" comp=\"'.$preModAppt->zimbraCompNum.'\" >';\n $soap .= '<inst d=\"'.$this->Date4Zimbra($except->exceptionstarttime, $tzName).'\" tz=\"'.$tzName.'\" />';\n $soap .= '</CancelAppointmentRequest>';\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n if($response) {\n $array = json_decode($response, true);\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'CancelAppointmentRequest (Exception):' . print_r( $array, true ) );\n unset($response);\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { true }');\n// return $this->StatMessage($this->_folders[$index]->devid, $id);\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'SOAP ['.$soap.']' );\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { false }');\n return false;\n }\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): Input Except I ['.$i.'] is a new exception occurrence' );\n\n// $soap = '<CreateAppointmentExceptionRequest xmlns=\"urn:zimbraMail\" id=\"'.$preModAppt->zimbraInvId.'\" comp=\"'.$preModAppt->zimbraCompNum.'\" ms=\"'.$preModAppt->zimbraMs.'\" rev=\"'.$preModAppt->zimbraRev.'\" >';\n $soap = '<CreateAppointmentExceptionRequest xmlns=\"urn:zimbraMail\" id=\"'.$preModAppt->zimbraInvId.'\" comp=\"'.$preModAppt->zimbraCompNum.'\" >';\n $soap .= '<m l=\"'.$zimbraFolderId.'\" >';\n\n $soap .= '<inv uid=\"'.$preModAppt->uid.'\" >';\n $soap .= '<comp ';\n\n /* Free/Busy Status\n fba=\"F|B|T|O\"\n F => 0\n B => 2\n T => 1\n O => 3 // ?\n */\n if (!isset($except->busystatus) && isset($preModAppt->busystatus)) { $except->busystatus = $preModAppt->busystatus; } \n if (isset($except->busystatus)) {\n if($except->busystatus == 0) {\n $soap .= 'fb=\"F\" ';\n } else if($except->busystatus == 1) {\n $soap .= 'fb=\"T\" ';\n } else if($except->busystatus == 2) {\n $soap .= 'fb=\"B\" ';\n } else if($except->busystatus == 3) {\n $soap .= 'fb=\"O\" ';\n }\n } else $soap .= 'fb=\"B\" ';\n\n\n /* Sensitivity Status\n [class=\"PUB|PRI|CON\"]\n PUB => 0 // Default\n PRI => 1\n CON => 2\n */\n if (isset($except->sensitivity)) {\n if($except->sensitivity == 0) {\n $soap .= 'class=\"PUB\" ';\n } else if($except->sensitivity == 1) {\n $soap .= 'class=\"PRI\" ';\n } else if($except->sensitivity == 2) {\n $soap .= 'class=\"CON\" ';\n }\n } else $soap .= 'class=\"PUB\" ';\n\n\n // allday\n if ((isset($except->alldayevent)) && ($except->alldayevent == 1)) {\n $soap .= 'allDay=\"1\" ';\n } else {\n $soap .= 'allDay=\"0\" ';\n } \n\n // subject\n if(isset($except->subject)) {\n $soap .= 'name=\"'.htmlspecialchars($except->subject).'\" ';\n }\n\n // location\n if(isset($except->location)) {\n $soap .= 'loc=\"'.htmlspecialchars($except->location).'\" ';\n }\n\t\t\t\t\n // close <comp ... >\n $soap .= '> ';\n $soap .= '<exceptId d=\"'.$this->Date4Zimbra($except->exceptionstarttime, $tzName).'\" tz=\"'.$tzName.'\" />';\n\n/* Not sure if I should just set myself - or try to keep parent ?\n if($id == '') {\n $soap .= '<or a=\"'.$this->_sendAsEmail.'\" d=\"'.$this->_sendAsName.'\"/> ';\n } else {\n //organizer - R47 - don't change if updating an existing appointment\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Modifying Appointment - Attempting to keep saved Organizer ['.$preModAppt->organizername.'] - Email ['.$preModAppt->organizeremail.']' );\n\n if (isset($preModAppt->organizeremail) && (trim($preModAppt->organizeremail) != \"\")) {\n $soap .= '<or a=\"'.$preModAppt->organizeremail.'\" ';\n if (isset($preModAppt->organizername) && (trim($preModAppt->organizername) != \"\")) {\n $soap .= ' d=\"'.$preModAppt->organizername.'\" ';\n }\n $soap .= ' /> ';\n }\n }\n*/\n// Will try keeping Parent\n if (isset($preModAppt->organizeremail) && (trim($preModAppt->organizeremail) != \"\")) {\n $soap .= '<or a=\"'.$preModAppt->organizeremail.'\" ';\n if (isset($preModAppt->organizername) && (trim($preModAppt->organizername) != \"\")) {\n $soap .= ' d=\"'.$preModAppt->organizername.'\" ';\n }\n $soap .= ' /> ';\n }\n\n if ((isset($except->alldayevent)) && ($except->alldayevent == 1)) {\n \t\n \t //starttime\n \t $starttime = $this->Date4Zimbra($except->starttime, $tzName);\n \t $starttime = substr( $starttime, 0, 8);\n \t $soap .= '<s d=\"'.$starttime.'\"/> ';\n\n \t //endtime\n \t // As Zimbra stores both start and end as the same date (unlike ActiveSync) we need to subtract 1 day\n \t $endtime = $this->Date4Zimbra($except->endtime - 86400, $tzName);\n \t $endtime = substr( $endtime, 0, 8 );\n \t $soap .= '<e d=\"'.$endtime.'\"/> ';\n } else {\n\n if ($this->_zimbraVersion == '5.0' ) {\n $v5tz = $this->LookupV5Timezone( $tzName, \"\");\n if ($v5tz !== false) {\n $v5tzAttribute = ' tz=\"'.$v5tz.'\" ';\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . \"Incoming Meeting v6 TimeZone [\".$tzName.\"] NOT FOUND in v5timezone.xml - APPOINTMENT START/END TIMES WILL BE SAVED TO ZIMBRA WITH NO SET TIMEZONE\" );\n $v5tzAttribute = '';\n }\n\n //starttime\n $soap .= '<s '.$v5tzAttribute.' d=\"'.$this->Date4Zimbra($except->starttime, $tzName).'\"/> ';\n\n //endtime\n $soap .= '<e '.$v5tzAttribute.' d=\"'.$this->Date4Zimbra($except->endtime, $tzName).'\"/> ';\n } else {\n\t \t\t\t\t\t//starttime\n\t \t\t\t\t\t$soap .= '<s tz=\"'.$tzName.'\" d=\"'.$this->Date4Zimbra($except->starttime, $tzName).'\"/> ';\n\t\t\t\t\t\n\t \t\t\t\t\t//endtime\n\t \t\t\t\t\t$soap .= '<e tz=\"'.$tzName.'\" d=\"'.$this->Date4Zimbra($except->endtime, $tzName).'\"/> ';\n }\n } \n\n if(isset($except->reminder)){\n $soap .='<alarm action=\"DISPLAY\">\n <trigger>\n <rel neg=\"1\" m=\"'.$except->reminder.'\" related=\"START\"/>\n </trigger>\n </alarm> ';\n }\n\n //attendees\n if(isset($except->attendees)) {\n $attendees = $except->attendees;\n } elseif(isset($preModAppt->attendees)) {\n $attendees = $preModAppt->attendees;\n }\n if (isset($attendees)) {\n foreach($attendees as $attendee) {\n if (isset($attendee->email)) {\n $soap .= '<at a=\"'.$attendee->email.'\" ';\n if (isset($attendee->name)) {\n $soap .= ' d=\"'.$attendee->name.'\" ';\n }\n\n if(isset($attendee->type) && $attendee->type == 2) {\n $soap .= 'role=\"OPT\" ';\n } else {\n $soap .= 'role=\"REQ\" ';\n }\n $soap .= 'ptst=\"NE\" rsvp=\"1\" />';\n }\n }\n unset( $attendees );\n unset( $attendee );\n }\n\n // end <comp> & <inv>\n $soap .= '</comp></inv>';\n\n //subject\n if (isset($except->subject) && trim($except->subject) != trim($input->subject)) {\n $soap .= '<su>'.htmlspecialchars($except->subject).'</su>';\n }\n\n $notes = \"\";\n $notesType = 1;\n if ((Request::GetProtocolVersion() >= 12)) {\n if (isset($except->asbody->data)) {\n if (is_resource($except->asbody->data)) {\n $notes = stream_get_contents($except->asbody->data);\n fclose($except->asbody->data);\n $notesType = $except->asbody->type;\n } else {\n $notes = $except->asbody->data;\n $notesType = $except->asbody->type;\n }\n }\n } else if ((Request::GetProtocolVersion() < 12) && isset($except->body) && ($except->body != \"\")) {\n $notes = $except->body;\n } else if(isset($except->rtf)) {\n if (class_exists('rtf', false)) {\n // start decode RTF if present\n $rtf_body = new rtf ();\n $rtf_body->loadrtf(base64_decode($except->rtf));\n $rtf_body->output(\"ascii\");\n $rtf_body->parse();\n $notes = w2ui( $rtf_body->out );\n unset( $rtf_body );\n } else {\n $notes = \"Missing include file z_RTF.php needed to Decode Notes\";\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'RTF field could not be handled - '.$notes.' - See notes in zimbra.php' );\n }\n }\n\n if ($notes <> \"\") { // Notes changed\n //plain text body unless type = 2 passed in.\n if ($notesType == 1) { \n $soap .= '<mp ct=\"text/plain\"><content>'.\"This instance of a recurring appointment has been changed \\n\\n\".htmlspecialchars($notes).'</content></mp>';\n } else {\n $soap .= '<mp ct=\"text/html\"><content>'.\"This instance of a recurring appointment has been changed &lt;BR&gt;&lt;BR&gt;\".htmlspecialchars($notes).'</content></mp>';\n }\n } \n\n //close <m>\n $soap .= '</m>';\n\n $soap .= '</CreateAppointmentExceptionRequest>';\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): SOAP ['.$soap.']' );\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n if($response) {\n $array = json_decode($response, true);\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'CreateApptException:' . print_r( $array, true ) );\n unset($response);\n if ($id == '') {\n $id = $array['Body']['CreateAppointmentExceptionResponse']['calItemId'];\n \t\t\t\t\t\tunset($array);\n } else {\n // Modifying existing appointment - Cannot apply TAGS to shared items - so don't even try\n// if (strrpos($id,':') === false) {\n if ('ME' == $idOwner) {\n $soap ='<ItemActionRequest xmlns=\"urn:zimbraMail\">\n <action id=\"'.$id.'\" op=\"update\" t=\"'.$inputtags.'\" />\n </ItemActionRequest> ';\n $actionResponse = $this->SoapRequest($soap, false, false, $returnJSON);\n if($actionResponse) {\n $actionArray = json_decode($actionResponse, true);\n if (!isset($actionArray['Body']['ItemActionResponse']['action']['id']) or !isset($actionArray['Body']['ItemActionResponse']['action']['op'])) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ChangeMessage APPOINTMENT TAG update failed');\n }\n }\n unset($actionResponse);\n }\n }\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { true }');\n// return $this->StatMessage($this->_folders[$index]->devid, $id);\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'SOAP ['.$soap.']' );\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage APPOINTMENT { false }');\n return false;\n }\n }\n }\n\n }\n\n foreach ($preModAppt->exceptions as $j=>$preModExcept) {\n \n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): preModExcept J ['.$j.'] needs to be deleted ???? - Should never happen as we should have received a \"Delete\" request for it' );\n }\n\n return $this->StatMessage($this->_folders[$index]->devid, $id);\n\n break;\n\n case 'task':\n\n// if (isset($input->categories) and (trim($input->categories) != \"\")) {\n/*\n if (isset($input->categories) and is_array($input->categories)) {\n $taskTagIds = $this->CategoriesToTags($input->categories);\n\t\t\t\t\n $tasktags = implode( \",\",$taskTagIds);\n $tagattribute = ' t=\"'.$tasktags.'\" ';\n\n } else {\n $tasktags = \"\";\n $tagattribute = \"\";\n }\n*/\n $taskOrganizer = $this->_sendAsEmail;\n\n\n if($id == '') {\n $soap = '<CreateTaskRequest xmlns=\"urn:zimbraMail\"><m l=\"'.$zimbraFolderId.'\" '.$inputattribute.' >';\n } else {\n $soap ='<GetMsgRequest xmlns=\"urn:zimbraMail\">\n <m id=\"'.$id.'\"></m>\n </GetMsgRequest>';\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n\n if($response) {\n $array = json_decode($response, true);\n \t\t \t unset($response); // We never use it again\n $item = $array['Body']['GetMsgResponse']['m'][0];\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . print_r( $item, true ) );\n unset($array);\n\n if (isset($item['inv'][0]['comp'][0]['desc'][0]['_content'])) {\n $originalPlainNotes = $item['inv'][0]['comp'][0]['desc'][0]['_content'];\n }\n if (isset($item['inv'][0]['comp'][0]['descHtml'][0]['_content'])) {\n $originalHtmlNotes = $item['inv'][0]['comp'][0]['descHtml'][0]['_content'];\n }\n // Organizer Email\n if(isset($item['inv'][0]['comp'][0]['or']['a'])) {\n $taskOrganizer = $item['inv'][0]['comp'][0]['or']['a'];\n }\n\n if (isset($item['l'])) {\n $originalFolderId = $item['l'];\n } else {\n $originalFolderId = $zimbraFolderId;\n }\n unset( $item );\n }\n\t\t\t\t\t\n $soap = '<ModifyTaskRequest xmlns=\"urn:zimbraMail\" id=\"'.$id.'\" comp=\"0\"><m l=\"'.$originalFolderId.'\" >';\n// $soap = '<ModifyTaskRequest xmlns=\"urn:zimbraMail\" id=\"'.$id.'\" comp=\"0\">';\n }\n\n $soap .= '<inv><comp ';\n\n /* Sensitivity Status\n [class=\"PUB|PRI|CON\"]\n PUB => 0 // Default\n PRI => 1\n CON => 2\n */\n if (isset($input->sensitivity)) {\n if($input->sensitivity == 0) {\n $soap .= 'class=\"PUB\" ';\n } else if($input->sensitivity == 1) {\n $soap .= 'class=\"PRI\" ';\n } else if($input->sensitivity == 2) {\n $soap .= 'class=\"CON\" ';\n }\n } else $soap .= 'class=\"PUB\" ';\n\n if (isset($input->importance)) {\n if($input->importance == 0) {\n $soap .= 'priority=\"9\" ';\n } else if($input->importance == 2) {\n $soap .= 'priority=\"1\" ';\n } else {\n $soap .= 'priority=\"5\" ';\n }\n } else $soap .= 'priority=\"5\" ';\n\n\n // allday\n //if($input->alldayevent == 0) {\n // $soap .= 'allDay=\"0\" ';\n //} else if($input->alldayevent == 1) {\n // $soap .= 'allDay=\"1\" ';\n //}\n\n // subject\n if(isset($input->subject)) {\n $soap .= 'name=\"'.htmlspecialchars($input->subject).'\" ';\n }\n\n // location\n if(isset($input->location)) {\n $soap .= 'loc=\"'.$input->location.'\" ';\n }\n\n //complete\n if(isset($input->complete) && $input->complete==1) {\n $soap .= ' status=\"COMP\" percentComplete=\"100\" ';\n }\n\n\n // close <comp ... >\n $soap .= '> ';\n\n\n // WM and hopefully all non-Nokia phones send the startdate and enddate field\n // as UTC timestamps of 00:00:00 hours on the actual start date, \n // and 00:00:00 hours on the actual due date. \n // This is ideal for zimbra that stores task related as dates in YYYYMMDD\n // format with no time of day.\n //\n // They send utcstartdate and utcduedate as the correctly offset time for the \n // local timezone in which the task was created. \n //\n // Nokia at this time does not allow entry of a startdate - but seems to leave\n // it intact for tasks pushed out to it that contain one.\n // However, on the Due date, it has real problems. If a task is created on the \n // Nokia phone, the enddate is sent correctly with the caveat that Nokia sends \n // 23:59:00 on the due date instead of 00:00:00 which other phnoes send. \n // On tasks created elsewhere, and subsequently edited on the phone it gets ugly.\n // It seems to do UTC-TZ manipulation on both the duedate and utcduedate fields\n // which results in the task end time creeping forward or backward depending on\n // your timezone offset from UTC.\n // For now - there is no reliable way to handle this situation. So just expect\n // potential problems updating tasks on a Nokia phone.\n // \n // I have opened a ticket with Nokia to try to get this fixed.\n\n\n // startdate if populated is sure to give correct date\n // fallback to utcstartdate with risk that we have wrong TZ set\n if(isset($input->startdate)) {\n $startdate = $this->Date4Zimbra($input->startdate, \"XMLnoZ\");\n $startdate = substr( $startdate, 0, 8);\n $soap .= '<s d=\"'.$startdate.'\"/> ';\n \t } else if(isset($input->utcstartdate)) {\n $startdate = $this->Date4Zimbra($input->utcstartdate, $this->_tz);\n \t $startdate = substr( $startdate, 0, 8);\n $soap .= '<s d=\"'.$startdate.'\"/> ';\n \t}\n \t\n \t// for duedate we need to try to determine the phone type\n // Nokia first\n if (stripos($this->_ua, \"MailforExchange\") !== false) {\n // duedate if populated is sure to give correct date\n // fallback to utcduedate with risk that we have wrong TZ set\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Task DueDate - Nokia' );\n if(isset($input->duedate)) {\n $duedate = $this->Date4Zimbra($input->duedate, \"XMLnoZ\");\n $duedate = substr( $duedate, 0, 8);\n $soap .= '<e d=\"'.$duedate.'\"/> ';\n } else if(isset($input->utcduedate)) {\n $duedate = $this->Date4Zimbra($input->utcduedate, $this->_tz);\n $duedate = substr( $duedate, 0, 8);\n $soap .= '<e d=\"'.$duedate.'\"/> ';\n }\n } else {\n // non-Nokia \n // duedate if populated is sure to give correct date\n // fallback to utcduedate with risk that we have wrong TZ set\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'Task DueDate - Non-Nokia' );\n if(isset($input->duedate)) {\n $duedate = $this->Date4Zimbra($input->duedate, \"XMLnoZ\");\n $duedate = substr( $duedate, 0, 8);\n $soap .= '<e d=\"'.$duedate.'\"/> ';\n } else if(isset($input->utcduedate)) {\n $duedate = $this->Date4Zimbra($input->utcduedate, $this->_tz);\n $duedate = substr( $duedate, 0, 8);\n $soap .= '<e d=\"'.$duedate.'\"/> ';\n }\n }\n\n //organizer\n $soap .= '<or a=\"'.$taskOrganizer.'\" sentBy=\"'.$this->_sendAsEmail.'\"/> ';\n\n // CLIENT UID\n if (isset($input->uid)) {\n $soap .='<xprop name=\"X-CLIENT-UID\" value=\"'.base64_encode($input->uid).'\"/>';\n }\n\n// TODO - Figure out if we should store all the additional info - Reminders/ Date Completed/ etc. that phone could use.\n// //datecompleted\n// if(isset($input->datecompleted)) {\n// $soap .= '<xprop name=\"datecompleted\" value=\"'.$this->ParseDate($input->datecompleted, \"toXML\").'\"/> ';\n// }\n// if (isset($input->reminderset) && $input->reminderset == 1) {\n// $soap .='<alarm action=\"DISPLAY\">\n// <trigger>\n// <rel m=\"'.$input->remindertime.'\" related=\"START\"/>\n// </trigger>\n// </alarm> ';\n// }\n\n // reminder time\n // TO DO - Find out if need to restrict to 7.0 onwards\n if (isset($input->reminderset) && ($input->reminderset == '1') && (floatval( $this->_zimbraVersion ) > 6.0) ) {\n if (isset($input->remindertime)) {\n $remindertime = $this->Date4Zimbra($input->remindertime, \"XML\") ;\n $soap .= '<alarm action=\"DISPLAY\"><trigger><abs d=\"'.$remindertime.'\"/></trigger></alarm> ';\n }\n \t } \n\n // end <comp> & <inv>\n $soap .= '</comp></inv>';\n\n $notes = \"\";\n $notesType = 1;\n if ((Request::GetProtocolVersion() >= 12)) {\n if (isset($input->asbody->data)) {\n \t\t\t\tif (is_resource($input->asbody->data)) {\n $notes = stream_get_contents($input->asbody->data);\n fclose($input->asbody->data);\n $notesType = $input->asbody->type;\n } else {\n $notes = $input->asbody->data;\n $notesType = $input->asbody->type;\n }\n }\n } else if ((Request::GetProtocolVersion() < 12) && isset($input->body) && ($input->body != \"\")) {\n $notes = $input->body;\n } else if(isset($input->rtf)) {\n if (class_exists('rtf', false)) {\n // start decode RTF if present\n $rtf_body = new rtf ();\n $rtf_body->loadrtf(base64_decode($input->rtf));\n $rtf_body->output(\"ascii\");\n $rtf_body->parse();\n $notes = w2ui( $rtf_body->out );\n unset( $rtf_body );\n } else {\n $notes = \"Missing include file z_RTF.php needed to Decode Notes\";\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'RTF field could not be handled - '.$notes.' - See notes in zimbra.php' );\n }\n }\n\n if ($notes <> \"\") { // Notes changed\n //plain text body unless type = 2 passed in.\n if ($notesType == 1) { \n $soap .= '<mp ct=\"text/plain\"><content>'.htmlspecialchars($notes).'</content></mp>';\n } else {\n $soap .= '<mp ct=\"text/html\"><content>'.htmlspecialchars($notes).'</content></mp>';\n }\n } else {\n if (isset($originalPlainNotes)) {\n $soap .= '<mp ct=\"text/plain\"><content>'.$originalPlainNotes.'</content></mp>';\n } elseif (isset($originalHtmlNotes)) {\n $soap .= '<mp ct=\"text/html\"><content>'.$originalHtmlNotes.'</content></mp>';\n }\n }\n\n //close <m>\n $soap .= '</m>';\n\n if($id == '') {\n $soap .= '</CreateTaskRequest>';\n } else {\n $soap .= '</ModifyTaskRequest>';\n }\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n if($response) {\n $array = json_decode($response, true);\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'CreateModifyTask:' . print_r( $array, true ) );\n if ($id == '') {\n unset($response);\n $id = $array['Body']['CreateTaskResponse']['invId'];\n unset($array);\n } else {\n // Modifying existing task - Cannot apply TAGS to shared items - so don't even try\n// if (strrpos($id,':') === false) {\n if ('ME' == $idOwner) {\n $soap ='<ItemActionRequest xmlns=\"urn:zimbraMail\">\n <action id=\"'.$id.'\" op=\"update\" t=\"'.$inputtags.'\" />\n </ItemActionRequest> ';\n $returnJSON = true;\n $actionResponse = $this->SoapRequest($soap, false, false, $returnJSON);\n if($actionResponse) {\n $actionArray = json_decode($actionResponse, true);\n if (!isset($actionArray['Body']['ItemActionResponse']['action']['id']) or !isset($actionArray['Body']['ItemActionResponse']['action']['op'])) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ChangeMessage ' . strtoupper($view) . ' TAG update failed');\n }\n }\n unset($actionResponse);\n }\n }\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage ' . strtoupper($view) . ' { true }');\n return $this->StatMessage($this->_folders[$index]->devid, $id);\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage ' . strtoupper($view) . ' { false }');\n return false;\n }\n break;\n\n case 'note':\n\n// if (isset($input->categories) and (trim($input->categories) != \"\")) {\n/*\t\n if (isset($input->categories) and is_array($input->categories)) {\n $taskTagIds = $this->CategoriesToTags($input->categories);\n\t\t\t\t\n $tasktags = implode( \",\",$taskTagIds);\n $tagattribute = ' t=\"'.$tasktags.'\" ';\n\n } else {\n $tasktags = \"\";\n $tagattribute = \"\";\n }\n*/\n\n if($id == '') {\n $soap = '<CreateTaskRequest xmlns=\"urn:zimbraMail\"><m l=\"'.$zimbraFolderId.'\" '.$inputattribute.' >';\n } else {\n $soap ='<GetMsgRequest xmlns=\"urn:zimbraMail\">\n <m id=\"'.$id.'\"></m>\n </GetMsgRequest>';\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n\n if($response) {\n $array = json_decode($response, true);\n \t\t \t unset($response); // We never use it again\n $item = $array['Body']['GetMsgResponse']['m'][0];\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . print_r( $item, true ) );\n unset($array);\n\n if (isset($item['inv'][0]['comp'][0]['desc'][0]['_content'])) {\n $originalPlainNotes = $item['inv'][0]['comp'][0]['desc'][0]['_content'];\n }\n if (isset($item['inv'][0]['comp'][0]['descHtml'][0]['_content'])) {\n $originalHtmlNotes = $item['inv'][0]['comp'][0]['descHtml'][0]['_content'];\n }\n unset( $item );\n }\n\t\t\t\t\t\n $soap = '<ModifyTaskRequest xmlns=\"urn:zimbraMail\" id=\"'.$id.'\" comp=\"0\"><m l=\"'.$zimbraFolderId.'\" >';\n }\n\n $soap .= '<inv><comp ';\n\n // Sensitivity Status\n $soap .= 'priority=\"5\" ';\n\n // subject\n if(isset($input->subject)) {\n $soap .= 'name=\"'.htmlspecialchars($input->subject).'\" ';\n }\n $soap .= ' status=\"NEED\" percentComplete=\"0\" ';\n\n // close <comp ... >\n $soap .= '> ';\n\n if(isset($input->lastmodified)) {\n $lastmodified = $this->Date4ActiveSync($input->lastmodified, \"UTC\");\n $lastmodified = $lastmodified . \"000\";\n $soap .= ' d=\"'.$lastmodified.'\" ';\n \t}\n \t\n // end <comp> & <inv>\n $soap .= '</comp></inv>';\n\n $notes = \"\";\n $notesType = 1;\n if ((Request::GetProtocolVersion() >= 12)) {\n if (isset($input->asbody->data)) {\n \t\t\t\tif (is_resource($input->asbody->data)) {\n $notes = stream_get_contents($input->asbody->data);\n fclose($input->asbody->data);\n $notesType = $input->asbody->type;\n } else {\n $notes = $input->asbody->data;\n $notesType = $input->asbody->type;\n }\n }\n } else if ((Request::GetProtocolVersion() < 12) && isset($input->body) && ($input->body != \"\")) {\n $notes = $input->body;\n } else if(isset($input->rtf)) {\n if (class_exists('rtf', false)) {\n // start decode RTF if present\n $rtf_body = new rtf ();\n $rtf_body->loadrtf(base64_decode($input->rtf));\n $rtf_body->output(\"ascii\");\n $rtf_body->parse();\n $notes = w2ui( $rtf_body->out );\n unset( $rtf_body );\n } else {\n $notes = \"Missing include file z_RTF.php needed to Decode Notes\";\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'RTF field could not be handled - '.$notes.' - See notes in zimbra.php' );\n }\n }\n\n if ($notes <> \"\") { // Notes changed\n //plain text body unless type = 2 passed in.\n if ($notesType == 1) { \n $soap .= '<mp ct=\"text/plain\"><content>'.htmlspecialchars($notes).'</content></mp>';\n } else {\n $soap .= '<mp ct=\"text/html\"><content>'.htmlspecialchars($notes).'</content></mp>';\n }\n } else {\n if (isset($originalPlainNotes)) {\n $soap .= '<mp ct=\"text/plain\"><content>'.$originalPlainNotes.'</content></mp>';\n } elseif (isset($originalHtmlNotes)) {\n $soap .= '<mp ct=\"text/html\"><content>'.$originalHtmlNotes.'</content></mp>';\n }\n }\n\n //close <m>\n $soap .= '</m>';\n\n if($id == '') {\n $soap .= '</CreateTaskRequest>';\n } else {\n $soap .= '</ModifyTaskRequest>';\n }\n\n $returnJSON = true;\n $response = $this->SoapRequest($soap, false, false, $returnJSON);\n if($response) {\n $array = json_decode($response, true);\n//ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'CreateModifyTask:' . print_r( $array, true ) );\n if ($id == '') {\n unset($response);\n $id = $array['Body']['CreateTaskResponse']['invId'];\n unset($array);\n } else {\n // Modifying existing task - Cannot apply TAGS to shared items - so don't even try\n// if (strrpos($id,':') === false) {\n if ('ME' == $idOwner) {\n $soap ='<ItemActionRequest xmlns=\"urn:zimbraMail\">\n <action id=\"'.$id.'\" op=\"update\" t=\"'.$inputtags.'\" />\n </ItemActionRequest> ';\n $returnJSON = true;\n $actionResponse = $this->SoapRequest($soap, false, false, $returnJSON);\n if($actionResponse) {\n $actionArray = json_decode($actionResponse, true);\n if (!isset($actionArray['Body']['ItemActionResponse']['action']['id']) or !isset($actionArray['Body']['ItemActionResponse']['action']['op'])) {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'ChangeMessage ' . strtoupper($view) . ' TAG update failed');\n }\n }\n unset($actionResponse);\n }\n }\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage ' . strtoupper($view) . ' { true }');\n return $this->StatMessage($this->_folders[$index]->devid, $id);\n } else {\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage ' . strtoupper($view) . ' { false }');\n return false;\n }\n break;\n }\n\n ZLog::Write(LOGLEVEL_DEBUG, 'Zimbra->ChangeMessage(): ' . 'END ChangeMessage { false (invalid folder view) }');\n return false;\n }", "function createFolder($newFolder,$email){\n$newFolder=$this->userFolder($email).\"/\".$newFolder; \n if (!file_exists($newFolder)) {\n mkdir($newFolder, 0777, true);\n return true;\n }else{\n return false; \n }\n}", "public function files_batch_move()\r\n {\t\r\n\t\t$this->folder_id = $this->post['move_folder_id'];\r\n\t\t$this->media_ids = array_filter(explode(',',urldecode($this->post['media_ids'])));\t\t\r\n\t\t$this->per_page = $this->post['per_page'];\r\n\t\t$this->page_num = $this->post['page_num'];\r\n\t\t\r\n\t\tforeach ($this->media_ids as $media_id)\r\n\t\t{\r\n\t\t\t$medium = \\Model_Medium::find($media_id);\r\n\t\t\t$medium->folder_id = $this->folder_id;\r\n\t\t\t\r\n\t\t\tif ($medium->save())\r\n\t\t\t{\r\n\t\t\t\t$this->output_response[] = \"Media has moved.\";\r\n\t\t\t}\r\n\t\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$this->output_response[] = \"Could not move the media.\";\r\n\t\t\t}\r\n\t\t}\t\r\n\t\t\t\t\r\n\t\t$this->set_folder_data();\r\n\t\t$this->set_media_data();\r\n\t\t$this->set_response();\r\n\t}", "public function move($path)\n {\n if(!$this->_connected)\n {\n triggerWarning('There is no active connection');\n return FALSE; \n }\n \n if(@ftp_rename($this->_connection , $oldFile , $newFile)) return TRUE;\n else\n {\n if($this->_warning == TRUE)\n {\n triggerWarning('Remote file ' . $path . 'could not be moved.');\n }\n return FALSE; \n }\n }" ]
[ "0.6892822", "0.6847699", "0.65137744", "0.613193", "0.6090514", "0.59291667", "0.59141445", "0.58087236", "0.5801065", "0.5795915", "0.5744534", "0.57217413", "0.5685637", "0.5657139", "0.5607159", "0.55902946", "0.55712986", "0.55518883", "0.55394906", "0.55242074", "0.5519358", "0.5516842", "0.550102", "0.5496297", "0.5492283", "0.54769623", "0.54691064", "0.54549277", "0.5407078", "0.5402665" ]
0.7093154
0
getLineNumber Gets the line number the error was raised at
public function getLineNumber() { return $this->line_num; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getLineNumber(): int\n {\n return $this->lineNumber;\n }", "function getLineNumber()\n {\n return $this->linenumber;\n }", "public function line(): int\n {\n return $this->errline;\n }", "public function getLine() : int\n {\n return $this->line;\n }", "public function lineno();", "public function getLineNo() {\n\n\t\t$container = $this->ownerDocument->getLineNumberContainer();\n\t\tif ($container && $container->contains($this)) {\n\t\t\treturn $container->offsetGet($this);\n\t\t}\n\n\t\treturn parent::getLineNo();\n\t}", "public function getLine(): int\n {\n return $this->line;\n }", "public function getLine(): int {\n\t\treturn $this->line;\n\t}", "function getlinenum() {\n return $this->linenum;\n }", "public function getCurrentLine()\n {\n return $this->lineno;\n }", "public function getTemplateLine()\n {\n return $this->_lineno;\n }", "private function get_line($linenumber) {\n $lines = $this->get_log_lines();\n\n return $lines[$linenumber];\n }", "public function getOriginalLine() : int\n {\n return $this->originalLine;\n }", "public function getEventTriggerLine()\n {\n $backtrace = $this->getDebugBacktrace();\n\n if (isset($backtrace[4]['line'])) {\n return $backtrace[4]['line'];\n }\n\n return '';\n }", "public function getLine(): ?int\n\t{\n\t\treturn isset($this->tokens[$this->position]) ? $this->tokens[$this->position]->line : null;\n\t}", "public function getLine()\n {\n return $this->iLine;\n }", "public function getErrorNumber()\n { \n return $this->_errorno;\n }", "public function getErrorNr()\n {\n return $this->errornr;\n }", "public function getStartLine(): int\n {\n return $this->startLine;\n }", "private function getLine() {\n\t\treturn $this->token->line;\n\t}", "function getLine()\n\t{\n\t\treturn $this->line;\n\t}", "public function getLine() {\n\t\treturn $this->line;\n\t}", "public function getLine() {\n\t\treturn $this->line;\n\t}", "public function getLine()\n {\n return $this->line;\n }", "public function getLine()\n {\n return $this->line;\n }", "public function getLine()\n {\n return $this->line;\n }", "public function getLine()\n {\n return $this->line;\n }", "public function getLine()\n {\n return $this->line;\n }", "public function getLine()\n {\n return $this->line;\n }", "public function getLine()\n\t{\n\t\treturn $this->line;\n\t}" ]
[ "0.80940133", "0.8074982", "0.7969081", "0.6930096", "0.6902084", "0.6901378", "0.68762016", "0.6851786", "0.68310475", "0.6759646", "0.6721437", "0.6715709", "0.66747946", "0.6527495", "0.65260446", "0.64945143", "0.6488873", "0.6456665", "0.64425117", "0.6427771", "0.6417226", "0.6370021", "0.6370021", "0.63497925", "0.63497925", "0.63497925", "0.63497925", "0.63497925", "0.63497925", "0.6332897" ]
0.8155507
0
Returns error messages for parameters with invalid values (from profile or registration form)
function getInvalidParameters($array) { foreach ($array as $key => $value) { switch (strtolower($key)) { case 'regno': $chunks = explode("/", $value); if (strlen($chunks[0]) != 4 || strlen($chunks[1]) != 6) { return "Invalid registration number"; } break; case 'first_name': if (strlen($value) < 2) { return "first name must contain atleast 2 characters"; } break; case 'last_name': if (strlen($value) < 2) { return "last name must contain atleast 2 characters"; } break; case 'password': //For time passwords if (strlen($value) < 8) { return "Password must contain atleast 8 characters"; } break; case 'password1': //For passwords with confirmations if (strlen($value) < 8) { return "Password must contain atleast 8 characters"; } break; case 'password2': //confirmation passwords if (strcasecmp($value, $array["password1"]) !== 0) { return "Passwords do not match"; } break; case 'email': if (filter_var($value, FILTER_VALIDATE_EMAIL) === FALSE) { return "Check email address"; } break; case 'dob': break; case 'phone': break; //Add more parameter cases as needed default : break; } } return ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate_values() {\n\t\t$error = array();\n\t\tif(empty($this->enrollno) || empty($this->name) || empty($this->fname) || empty($this->course) || empty($this->born) || empty($this->join)) {\n\t\t\t$error[] .= 'all_fields';\n\t\t}\n\t\tif($this->course == 'btech' && empty($this->branch)){\n\t\t\t$error[] .= 'all_fields';\n\t\t}\n\t\tif(strlen($this->enrollno) < 10 || strlen($this->enrollno) > 11) {\n\t\t\t$error[] .= 'enrollno_too_short';\n\t\t}\t\t\n\t\tif(!ctype_digit($this->enrollno)) {\n\t\t\t$error[] .= 'enrollno_digit';\n\t\t}\n\t\t// Define the Language variable for each type of error\n\t\tif($this->verify_if_enrollno_exists() == 0) {\n\t\t\t$error[] .= 'enrollno_exists';\n\t\t}\n\t\tif($this->verify_if_fname_exists() == 0) {\n\t\t\t$error[] .= 'fname_exists';\n\t\t}\n\t\tif($this->verify_if_name_exists() == 0) {\n\t\t\t$error[] .= 'name_exists';\n\t\t}\n\t\tif($this->verify_if_course_exists() == 0) {\n\t\t\t$error[] .= 'course_exists';\n\t\t}\n\t\tif($this->verify_if_branch_exists() == 0) {\n\t\t\t$error[] .= 'branch_exists';\n\t\t}\n\t\tif($this->verify_if_born_exists() == 0) {\n\t\t\t$error[] .= 'born_exists';\n\t\t}\n\t\tif($this->verify_if_join_exists() == 0) {\n\t\t\t$error[] .= 'join_exists';\n\t\t}\n\t\treturn $error;\n\t}", "public function messages()\n {\n return [\n 'first_name.required' => 'Please enter first name',\n 'last_name.required' => 'Please enter last name',\n 'languages.required' => 'Please select languages which you can speak',\n\n 'experience.required' => 'Please enter your experience',\n 'qualification.required' => 'Please enter your qualification',\n 'specialism.required' => 'Please enter your specialism'\n //'address.required' => 'Please enter your address',\n //'latitude.required' => 'Please enter your latitude',\n //'longitude.required' => 'Please enter your longitude'\n ];\n }", "public function messages()\n {\n return [\n 'in_config_key' => 'in_config_key validation error',\n 'in_config' => 'in_config validation error',\n 'owns_character' => 'The selected character do not belongs to your account.',\n ];\n }", "public function errorMessages()\n {\n return [\n self::REQUIRED => 'This field is required.',\n self::EMAIL => 'This field must be a valid email address.',\n self::MIN => 'Mininmun length of this field must be {min} characters.',\n self::MAX => 'Maximum length of this field must be {max} characters.',\n self::MATCH => 'This field must be the same as {match}',\n self::UNIQUE => 'Record with this {field} already existes',\n self::DOESNTEXIST => 'Record does not exist',\n self::PASSWORDVERIFY=> 'Wrong password',\n ];\n }", "public function messages()\n {\n return [\n // 'first_name.required' => 'Please insert Student First Name',\n // 'first_name.max' => 'Students First Name may not be greater than 191 characters.',\n ];\n }", "public function messages()\n\t{\n\t\treturn [\n\t\t\t'venue_id.required' => 'Please choose a venue',\n\t\t\t'name.unique_with' => '\"@name@\" has already been used'\n\t\t];\n\t}", "public function messages()\n {\n return [\n 'name.required' => 'Please provide valid name!',\n 'name.min' => 'Plese provide valid name which is between 4 and 100 characters.',\n 'age.required' => 'You should provide valid age.',\n 'countOfBooks.unique' => 'Enter how many books the author has.',\n 'genres.required' => 'Enter genre/genres!'\n ];\n }", "private function error_msg(){\n\t\t# Sanitize the user entered data to prevent any funny-business (re: SQL Injection Attacks)\n\t\t$_POST = DB::instance(DB_NAME)->sanitize($_POST);\n\t\t\n\t\t//Build query to find email/user\n\t\t$q_findemail=\"select email from users where email='\".$_POST['email'].\"'\" ;\n\t\t\n\t\t$username=DB::instance(DB_NAME)->select_field($q_findemail);\n\t\n\t\tif(!$username){ //Check if email is registered\n\t\t\t$this->error_provided=\"Username \". $_POST['email'].\" is not registered\";\n\t\t}\n\t\telse //Email is registered but password supplied by user is incorrect\n\t\t{\n\t\t\t$this->error_provided=\"Password supplied for user is incorrect\";\n\t\t}\n\t\t\n\t}", "public function messages()\n {\n return [\n 'first_name.required' => trans('errors.external_service_provider_edit.first_name'),\n 'last_name.required' => trans('errors.external_service_provider_edit.last_name'),\n 'email.required' => trans('errors.external_service_provider_edit.email'),\n 'mobile.required' => trans('errors.external_service_provider_edit.mobile'),\n 'address.required' => trans('errors.external_service_provider_edit.address'),\n 'lat.required' => trans('errors.external_service_provider_edit.address'),\n 'lng.required' => trans('errors.external_service_provider_edit.address'),\n ];\n }", "public function getErrorMessage();", "public function getErrorMessage();", "public function getErrorMessage();", "public static function getErrorMsgArgs()\n {\n return __('Error! The action you wanted to perform was not successful for some reason, maybe because of a problem with what you input. Please check and try again.');\n }", "function get_form_errors( $values ) {\n\n\t\t$errors = array();\n\n\t\tif ( empty( $values['mailchimp-api-key'] ) ) {\n\t\t\t$errors[] = __( 'The MailChimp API Key field cannot be left blank.', 'LION' );\n\t\t} else {\n\n\t\t\t$response = it_exchange_mailchimp_api_request( '', 'GET', array(), null, array(\n\t\t\t\t'api_key' => trim( $values['mailchimp-api-key'] )\n\t\t\t) );\n\n\t\t\tif ( is_wp_error( $response ) ) {\n\t\t\t\t$errors[] = $response->get_error_message();\n\t\t\t}\n\t\t}\n\n\t\tif ( empty( $values['mailchimp-label'] ) )\n\t\t\t$errors[] = __( 'The MailChimp sign-up label cannot be left blank.', 'LION' );\n\n\n\t\treturn $errors;\n\t}", "public function messages()\n {\n return [\n 'private_name.required' => 'Private Name Required',\n 'site_name.required' => 'Site Name Required',\n 'address.required' => 'Address Required',\n 'city.required' => 'City Required',\n 'state.required' => 'State Required',\n 'vol_condition.required' => 'Open to which Required',\n 'medical_condition.required' => 'Medical Condition Required',\n 'rationale.required' => 'Rationale Required',\n 'summary_exc_inc.required' => 'Summary Required',\n 'participation.required' => 'Participation Required',\n 'placebo.required' => 'Placebo Required',\n ];\n }", "public static function messages(){\n return [\n 'fk_users.required' => 'You must be logged in to post reviews',\n 'fk_products.required' => 'Product not found',\n 'star.required' => 'Your rating is required',\n 'comments.required' => 'Your review is required',\n ];\n }", "protected function formCheckForErrors() {\n extract($this->getFormParams());\n \n if ($id && is_nan($id)) {\n return \"<p>ID must be a number</p>\";\n }\n else if (!$title) {\n return \"<p>Title cannot be empty</p>\";\n }\n else if (is_nan($year) || $year < 1900 || $year > 2100) {\n return \"<p>Year must be between 1900 and 2100</p>\";\n }\n else if (is_nan($length) || $length < 1 || $length > 14400) {\n return \"<p>Length must be between 1 and 14400</p>\";\n }\n else if (count($genres) == 0) {\n return \"<p>At least one genre must be selected</p>\";\n }\n else if ($_FILES[\"image\"][\"name\"] && (($imgType = pathinfo(basename($_FILES[\"image\"][\"name\"]),PATHINFO_EXTENSION)) != \"jpg\") &&\n ($imgType != \"jpeg\") && ($imgType != \"gif\") && ($imgType != \"png\")){\n return \"<p>Image must be .jpg, .jpeg, .gif or .png (it is .{$imgType})</p>\";\n }\n\n return false;\n }", "public function messages() {\n return [\n 'label.required' => 'The permissions name field is required.',\n 'isActive.required' => 'A valid \"is active\" value is required.',\n 'isActive.in:0,1' => 'A valid \"is active\" value is required.',\n ];\n }", "public function messages()\n {\n return [\n 'pin.required' => 'Please enter your pin number',\n ];\n }", "public function login_validate_error_provider() {\n return array(\n //username and password null\n array(\n array(\n 'username' => '',\n 'password' => ''\n )\n ),\n // username null\n array(\n array(\n 'username' => '',\n 'password' => '123456'\n )\n ),\n // password null\n array(\n array(\n 'username' => 'phamtam2',\n 'password' => ''\n )\n ),\n );\n }", "public function messages()\n {\n return [\n 'required' => 'The :attribute field is required.',\n 'password.min' => 'The field password must contain not less than 6 characters',\n 'email.email' => 'The field email must have format as an e-mail address',\n 'unique' => 'User with this :attribute already exists'\n ];\n }", "public function messages()\n {\n return [\n 'first_name.required' => trans('errors.support_worker.first_name'),\n 'last_name.required' => trans('errors.support_worker.last_name'),\n 'email.required' => trans('errors.support_worker.email'),\n 'mobile.required' => trans('errors.support_worker.email'),\n 'address.required' => trans('errors.support_worker.address'),\n 'lat.required' => trans('errors.invalid_address'),\n 'registration_groups.required' => trans('errors.support_worker.registration_groups')\n ];\n }", "public function messages()\n {\n return [\n 'name' => 'The :attribute value is required :input is not between 1:min - 32:max.',\n 'author_name' => 'The :attribute value :input is no more then 32:max.',\n ];\n }", "public function messages(){\n\n return [\n 'purpose.required'=>'Please state purpose of booking',\n 'start_date.required'=>'Please select start date',\n 'end_date.required'=>'Please select end date',\n 'attachment.required'=>'Please upload relevant attachment',\n ];\n }", "public function messages()\n {\n return [\n 'firstname.unique' => 'Name of graduate already exists.',\n 'firstname.required' => 'First name is required',\n 'lastname.required' => 'Last name is required',\n 'gender.required' => 'Gender is required.',\n 'address.required' => 'Address is required.',\n 'dept.required' => 'Department is required.',\n 'school.required' => 'School is required.',\n 'course.required' => 'Course is required.',\n 'major.required' => 'Major is required.',\n 'sy.required' => 'School year is required.',\n 'batch.required' => 'Batch is required.'\n ];\n }", "protected function getDefaultMessage(): string\n {\n return 'Invalid params';\n }", "public function getErrorInfo();", "public function json_structure_user_update_profile_error() {\n return [\n 'message',\n 'errors',\n 'code',\n 'request'\n ];\n }", "public function messages()\n {\n return [\n 'firstname.*' => 'Please type your firstname',\n 'lastname.*' => 'Please type your lastname',\n 'email.unique' => 'This address is taken. Do you already have an account?',\n 'languages.*' => 'You need to at least choose one language',\n 'location.*' => 'Please pick your home country',\n 'location.country.id' => 'Please choose a country from the list',\n 'university.*' => 'Please pick your university. If it\\'s not in the list, type its name',\n 'timezone.*' => 'Please pick your display timezone. Date and time will be adapted to the chosen timezone.',\n 'degree_id.*' => 'Choose your current degree program.',\n 'shirt_id.*' => 'You will need to pick a shirt that you will later wear.',\n ];\n }", "function getErrorMessage();" ]
[ "0.70239383", "0.65741706", "0.6568035", "0.64620256", "0.64370334", "0.63868874", "0.636156", "0.6356304", "0.6341526", "0.6319481", "0.6319481", "0.6319481", "0.6316975", "0.6312921", "0.62863106", "0.62811166", "0.62790036", "0.6272018", "0.6264871", "0.6259123", "0.6243554", "0.622441", "0.62241596", "0.62061775", "0.61959904", "0.617991", "0.61773384", "0.6172953", "0.6170364", "0.61437213" ]
0.6911553
1
product_categories = pivot table, tabel pernghubung
public function categories() { return $this->belongsToMany(Category::class, 'product_categories'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function categories()\n {\n return $this->belongsToMany(ProductCategory::class, 'product_product_category', 'product_id', 'product_category_id')\n ->withPivot('main')\n ->withTimestamps();\n }", "public function productcategories()\n {\n return $this->belongsToMany('App\\ProductCategory')->withTimestamps();\n }", "public function mainCategory()\n {\n return $this->belongsToMany(ProductCategory::class)\n ->wherePivot('main', true);\n }", "function getProductsWithCategory() {\r\n $query = $this->db->prepare(\"SELECT productos.*, categorias.nombre as categoria FROM productos JOIN\r\n categorias ON productos.id_categoria = categorias.id_categoria\"); //cuando dice \"as\" renombra a categorias.nombre por categoria para que no se solape con producto.nombre\r\n $query->execute();\r\n return $query->fetchAll(PDO::FETCH_OBJ);\r\n }", "public function categories()\n {\n return $this->belongsToMany(Category::class,\n 'product_categories',\n 'products_id',\n 'categories_id'\n )->select('categories.id', 'categories.name',\n 'categories.status', 'categories.parent_id');\n }", "public function products(){\n return $this->belongsToMany('App\\Product');//making one to many relation where category has many products\n }", "public function products()\n {\n return $this->belongsToMany('App\\Product')->withPivot('quantidade','valor_unitario', 'valor_total', 'obs');\n }", "public function categories()\n {\n return $this->belongsToMany(Category::class, 'category_products');\n }", "public function products()\n {\n return $this->belongsToMany(Product::class, 'category_product');\n }", "public function product_categories()\n\t{\n\t\treturn AutoModeler_ORM::factory('vendo_product_category')->full_tree(\n\t\t\tNULL, TRUE, $this->product\n\t\t);\n\t}", "public function categories(){return $this->belongsToMany('App\\Category', 'category_property', 'property_id', 'category_id')->withPivot('required');}", "public function products()\n {\n return $this->belongsToMany(Product::class, 'category_product', 'category_id', 'product_id');\n }", "public function run()\n {\n Product::create([\n\n 'name' => 'Jeans ala BNCC',\n 'slug' => 'jeans-bncc',\n 'details' => 'Bahan Jeans, 2 Kantong',\n 'price' => 150000,\n 'description' => 'Spicy jalapeno bacon ipsum dolor amet shank jerky cupim beef ribs kevin pork belly jowl \n tongue biltong tail capicola picanha short ribs cow. \n Meatball pastrami alcatra, leberkas chuck andouille pancetta pork hamburger shankle.'\n\n ])->categories()->attach(1);\n\n Product::create([\n\n 'name' => 'Kaos ala BNCC',\n 'slug' => 'kaos-bncc',\n 'details' => 'Bahan katun, warna putih',\n 'price' => 100000,\n 'description' => 'Spicy jalapeno bacon ipsum dolor amet shank jerky cupim beef ribs kevin pork belly jowl \n tongue biltong tail capicola picanha short ribs cow. \n Meatball pastrami alcatra, leberkas chuck andouille pancetta pork hamburger shankle.'\n\n ])->categories()->attach(2);\n\n Product::create([\n\n 'name' => 'Kutang ala BNCC',\n 'slug' => 'kutang-bncc',\n 'details' => 'Bahan katun, Polkadot',\n 'price' => 50000,\n 'description' => 'Spicy jalapeno bacon ipsum dolor amet shank jerky cupim beef ribs kevin pork belly jowl \n tongue biltong tail capicola picanha short ribs cow. \n Meatball pastrami alcatra, leberkas chuck andouille pancetta pork hamburger shankle.'\n\n ])->categories()->attach(3);\n\n Product::create([\n\n 'name' => 'Kaos Kutang ala BNCC',\n 'slug' => 'kaos-1-bncc',\n 'details' => 'Bahan sutra',\n 'price' => 70000,\n 'description' => 'Spicy jalapeno bacon ipsum dolor amet shank jerky cupim beef ribs kevin pork belly jowl\n tongue biltong tail capicola picanha short ribs cow.\n Meatball pastrami alcatra, leberkas chuck andouille pancetta pork hamburger shankle.'\n\n ])->categories()->attach(3);\n\n $product = Product::findOrFail(4);\n $product->categories()->attach(2);\n }", "public function run()\n {\n Product::create([\n 'categories_id'=>1,\n 'NombreProducto'=>'Indio',\n 'precio'=>30\n ]);\n\n Product::create([\n 'categories_id'=>1,\n 'NombreProducto'=>'Sol',\n 'precio'=>30\n ]);\n\n Product::create([\n 'categories_id'=>1,\n 'NombreProducto'=>'xx lager',\n 'precio'=>35\n ]);\n\n Product::create([\n 'categories_id'=>1,\n 'NombreProducto'=>'Corona',\n 'precio'=>30\n ]);\n\n Product::create([\n 'categories_id'=>1,\n 'NombreProducto'=>'heineken',\n 'precio'=>35\n ]);\n\n Product::create([\n 'categories_id'=>2,\n 'NombreProducto'=>'Margarita',\n 'precio'=>50\n ]);\n\n Product::create([\n 'categories_id'=>2,\n 'NombreProducto'=>'Martini',\n 'precio'=>50\n ]);\n\n Product::create([\n 'categories_id'=>2,\n 'NombreProducto'=>'Mojito',\n 'precio'=>55\n ]);\n\n Product::create([\n 'categories_id'=>2,\n 'NombreProducto'=>'Bloody Mary',\n 'precio'=>50\n ]);\n\n Product::create([\n 'categories_id'=>2,\n 'NombreProducto'=>'Piña colada',\n 'precio'=>50\n ]);\n\n Product::create([\n 'categories_id'=>2,\n 'NombreProducto'=>'Cubalibre',\n 'precio'=>55\n ]);\n\n Product::create([\n 'categories_id'=>3,\n 'NombreProducto'=>'Coca cola',\n 'precio'=>50\n ]);\n\n Product::create([\n 'categories_id'=>3,\n 'NombreProducto'=>'Fanta',\n 'precio'=>50\n ]);\n\n Product::create([\n 'categories_id'=>3,\n 'NombreProducto'=>'Sprite',\n 'precio'=>55\n ]);\n\n Product::create([\n 'categories_id'=>3,\n 'NombreProducto'=>'Fresca',\n 'precio'=>50\n ]);\n\n Product::create([\n 'categories_id'=>3,\n 'NombreProducto'=>'Del valle',\n 'precio'=>50\n ]);\n\n Product::create([\n 'categories_id'=>3,\n 'NombreProducto'=>'Mundet',\n 'precio'=>55\n ]);\n\n Product::create([\n 'categories_id'=>4,\n 'NombreProducto'=>'Café expreso',\n 'precio'=>45\n ]);\n\n Product::create([\n 'categories_id'=>4,\n 'NombreProducto'=>'Café cortado',\n 'precio'=>35\n ]);\n\n Product::create([\n 'categories_id'=>4,\n 'NombreProducto'=>'Café capuchino',\n 'precio'=>60\n ]);\n\n Product::create([\n 'categories_id'=>4,\n 'NombreProducto'=>'Café irlandés',\n 'precio'=>70\n ]);\n\n Product::create([\n 'categories_id'=>4,\n 'NombreProducto'=>'Café turco',\n 'precio'=>60\n ]);\n\n Product::create([\n 'categories_id'=>4,\n 'NombreProducto'=>'Café flambeado',\n 'precio'=>55\n ]);\n //factory(Product::class, 100)->create();\n }", "public function findAllProductsWithCategories(){\n\n\n $q = $this->createQueryBuilder('p')\n ->addSelect('c')\n ->join('p.category', 'c')\n ->getQuery();\n //die(dump($q->getResult()));\n return $q->getResult();\n }", "public function productos()\n {\n return $this->belongsToMany('App\\Producto')->withPivot('cantidad', 'precio', 'real', 'observacion', 'fecha_vencimiento');\n }", "public function categories()\n {\n return $this->belongsToMany(RestaurantCategory::class, 'restaurant_category_pivot' ,'restaurant_id', 'category_id');\n }", "public function produits(){\n return $this->belongsToMany('App\\Product', 'commande_products')->withPivot('quantity', 'prix_unit_ttc', 'prix_total_ttc');\n }", "public function products()\n {\n return $this->belongsToMany('App\\Product')->withPivot('price', 'quantity')->withTimestamps();\n }", "function putcateory($products) {\n $product_count = [];\n $product_count = $this->categorycount($products);\n // print_r($product_count); \n foreach ($products as $key => $value) {\n $ct = substr($value->category, 1);\n if(array_key_exists($ct-1,$product_count)){\n if ($product_count[$ct-1] != 0){\n $value->category .= \"-P\".$value->product_id;\n $product_count[$ct-1] -=1; \n }\n }\n }\n return $products;\n }", "public function categories()\n {\n return $this\n \t->belongsToMany('App\\Models\\Event\\VendorCategory', 'pivot_event_category', 'event_id', 'vendor_category_id')\n \t->withPivot('slots');\n }", "public function products_category()\n {\n \n $value = $this->buy_product_mdl->fetch_categories();\n return $value;\n }", "public function products()\n {\n return $this->belongsToMany(Product::class,'product_quotation')->withPivot('quantities');\n }", "public function products()\n {\n return $this->belongsToMany('App\\Product')->withPivot('quantity');\n }", "public function categories()\n {\n return $this->belongsToMany('App\\Category')->withPivot('film_id', 'category')->withTimestamps();;\n }", "public function products(): BelongsToMany\n {\n return $this->belongsToMany(Product::class, 'category_product', 'category_id', 'product_id');\n }", "public function categories(): BelongsToMany\n {\n return $this->belongsToMany(Category::class, 'netcore_product__category_parameter');\n }", "public function producto (){\n //utilizo el metodo de eloquent: hasMany\n return $this->hasMany('App\\Producto', 'idCategoria');\n }", "public function products()\n {\n return $this->hasMany(product::class,'category_id','id');\n }", "public function products()\n {\n return $this->\n belongsToMany(Product::class, 'category_product', 'category_id', 'product_id');\n }" ]
[ "0.7242497", "0.65422034", "0.64770705", "0.6456751", "0.63856053", "0.63598555", "0.6353203", "0.634937", "0.6307813", "0.628841", "0.6248127", "0.62302506", "0.6173619", "0.6164979", "0.6155189", "0.61450034", "0.6115498", "0.6114481", "0.609838", "0.6068556", "0.6042126", "0.603602", "0.60244006", "0.5995837", "0.5995458", "0.59425807", "0.594068", "0.5888096", "0.58590686", "0.58500826" ]
0.6556404
1
Get the value of numContrat
public function getNumContrat() { return $this->numContrat; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getNumColegiado()\n {\n return $this->NumColegiado;\n }", "public function RiesgoClasificacionAValor()\n {\n $valor = 0;\n \n switch ($this->clasificacionRcvg) {\n case \"BAJO\":\n $valor = 1;\n break;\n \n case \"MODERADO\":\n $valor = 2;\n break;\n \n case \"ALTO\":\n $valor = 3;\n break;\n \n case \"MUY ALTO\":\n $valor = 4;\n break;\n \n default:\n break;\n }\n \n return($valor);\n }", "public function getValue () :int {\n\treturn $this->nombre;\n\t}", "public function obtenerCantidad() {\n return $this->cant;\n }", "public function getCantidad(){\n return $this->cantidad;\n }", "public function getcantidad()\r\n\t{\r\n\t\treturn $this->cantidad;\r\n\t}", "public function setNumContrat($numContrat)\n {\n $this->numContrat = $numContrat;\n\n return $this;\n }", "public function getCantidad()\n {\n return $this->cantidad;\n }", "public function getCantidad()\n {\n return $this->cantidad;\n }", "function Number()\r\n\t{\r\n\t\treturn $this->_ccNum;\r\n\t}", "public function getCtrValor()\n {\n return $this->ctrValor;\n }", "public function getNumeroCompte() {\n return $this->numeroCompte;\n }", "public function getNumeroCompte() {\n return $this->numeroCompte;\n }", "public function getNum()\n {\n return $this->num;\n }", "public function getNum()\n {\n return $this->num;\n }", "public function getNum() {\n return $this->get(self::NUM);\n }", "public function getCodClinica()\n {\n return $this->getModel()->getValor(\"codClinica\");\n }", "public function getnumfact()\n {\n return $this->numfact;\n }", "public function getConvNum($base) {\n\t\t$tmp_num = $this->num;\n\t\t$tmp_base = $this->base;\n\t\t// dbg var_dump($this);\n\t\t$this->setBase($base);\n\t\t// dbg var_dump($this);\n\t\t$ret = $this->num;\n\t\t$this->num = $tmp_num;\n\t\t$this->base = $tmp_base;\n\t\treturn $ret;\n\t}", "public function numTotalDeRegistros(){\r\n return $this->numTotalDeRegistros;\r\n }", "public function getCantidadProduccion()\n {\n return $this->CantidadProduccion;\n }", "public function getNumOrdre() {\n return $this->numOrdre;\n }", "public function getCounter()\n {\n if (!$this->Contador) {\n $this->Contador = $this->getRelationFk('Contador', 'contador_idcontador');\n }\n\n return $this->Contador;\n }", "public function getValue(): int;", "public function getAnoCompetencia() {\n return $this->iAnoCompentencia;\n }", "public function getCintura() {\n return $this->iCintura;\n }", "public function getActif():int\n {\n return $this->actif;\n }", "function getNossoNumeroCertificado(){\n\t\t\t$consulta = mysql_query(\"SELECT * FROM boletos_registrados WHERE tipo = 'certificado' AND status = 'pendente' AND id_user = '\".$this->getid_user().\"' \");\n\t\t\t$objeto_consulta = mysql_fetch_array($consulta);\n\t\t\treturn substr( $objeto_consulta['nosso_numero'] , 7 , 10 );\t\t\n\t\t}", "public function getValor() {\n return $this->nValor;\n }", "function member_num() {\n $val_search = $this->val_search_get();\n $result_arr = $this->xdb->read_num($this->xtb, 'drwx=\"0\" ' . $val_search . ' ');\n print_r($result_arr);\n }" ]
[ "0.65752125", "0.626035", "0.61420536", "0.6122609", "0.6064064", "0.6053465", "0.60441464", "0.6012486", "0.6012486", "0.59852594", "0.5961835", "0.5951565", "0.5951565", "0.586577", "0.586577", "0.58266056", "0.5810703", "0.57921076", "0.57830834", "0.5766401", "0.5745928", "0.5741576", "0.5719877", "0.57029134", "0.57017255", "0.56915295", "0.56765634", "0.56362504", "0.5619437", "0.5608232" ]
0.82233775
0
Set the value of numContrat
public function setNumContrat($numContrat) { $this->numContrat = $numContrat; return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getNumContrat()\n {\n return $this->numContrat;\n }", "public function asignarNivelConsecuencia()\n\t{\n\t\tif($this->evaluacion_riesgo_nivel_consecuencia==1)\n\t\t{\n\t\t\t$this->evaluacion_riesgo_nivel_consecuencia=10;\n\t\t}\n\t\tif($this->evaluacion_riesgo_nivel_consecuencia==2)\n\t\t{\n\t\t\t$this->evaluacion_riesgo_nivel_consecuencia=25;\n\t\t}\n\t\tif($this->evaluacion_riesgo_nivel_consecuencia==3)\n\t\t{\n\t\t\t$this->evaluacion_riesgo_nivel_consecuencia=60;\n\t\t}\n\t\tif($this->evaluacion_riesgo_nivel_consecuencia==4)\n\t\t{\n\t\t\t$this->evaluacion_riesgo_nivel_consecuencia=100;\n\t\t}\n\t}", "public function setNum(?int $num)\n {\n $this->num = $num;\n }", "public function cortesia()\n {\n $this->costo = 0;\n }", "public\tfunction\tsetNbChair($nbchair)\t{\n\t\t\t\t\t\t\t\t\t\t\t\t$this->nbchair\t=\t$nbchair;\n\t\t\t\t\t\t\t\t}", "public function setNumdias($data)\n {\n self::$numdias = $data;\n }", "function setCarrera($val)\r\n\t { $this->Carrera=$val;}", "public function setCnrps($cnrps)\n{\n if (!is_integer($cnrps) || empty($cnrps))\n {\n $this->erreurs[] = self::CNRPS_INVALIDE;\n }\n\n$this->cnrps = $cnrps;\n}", "function setOC(){\n\t\t$db=$this->db;\n\t\t$sql=\"UPDATE oneri.oneri_concessori SET totale = coalesce(oneri_urbanizzazione,0) + coalesce(oneri_costruzione,0)-(coalesce(scomputo_urb,0)+coalesce(scomputo_costr,0)) WHERE pratica=$this->pratica;\";\n\t\t$db->sql_query($sql);\n\t}", "public function setActif(int $actif):void\n {\n $actif = (int) $actif;\n if($actif < 0 || $actif > 1){\n trigger_error(\"Le champ actif doit être soit 0, soit 1\",E_USER_NOTICE);\n }\n else{\n $this->actif = $actif;\n }\n \n }", "protected function adjust($num)\n {\n if ($this->balance > $num){\n $this->balance -= $num;\n $this->flag = true;\n }else{\n $this->flag = false;\n }\n }", "public function setCantidad($cantidad){\n $this->cantidad = $cantidad;\n }", "public function primeiroDados()\n {\n $this->registro = 1;\n }", "function modificarNumFilhos($numFilhos)\n\t{\n\t\t$this->numFilhos = $numFilhos;\n\t}", "public function setCtrNumero($ctrNumero) {\n $this->ctrNumero = $ctrNumero;\n return $this;\n }", "public function setConfig($numOfStudent){\n $db_connection = $this->connect();\n\n if ($db_connection == NULL) return 101;\n\n $table = self::CONFIG;\n $set = \"numOfStudent = '{$numOfStudent}'\";\n \n $query = \"UPDATE {$table} SET {$set};\";\n \n /* Executing query */\n $result = $db_connection->query($query);\n\n // Disconnect from Database;\n $db_connection->close();\n\n return ($result == true) ? 0 : 1;\n\n }", "public function setControlPerPage($numOfControl){\n if($numOfControl){\n $this->_controls_per_page = $numOfControl;\n }\n }", "public function setNewCon($newCon)\n {\n $this->_newCon = (int) $newCon;\n }", "function setIdtrabajador($val) {$this->idtrabajador=$val;}", "function gen_control_number () {\n\t$result = mysql_query(\"SELECT ctrl_control_number FROM ctrl_control_number\") or die (mysql_error());\n\twhile ( $row = mysql_fetch_array($result) ) {\n\t\t$num_val = $row[\"ctrl_control_number\"];\n\t}\n \t$sql_string = \"UPDATE ctrl_control_number SET ctrl_control_number =\".($num_val+1);\n\t\t$result = mysql_query($sql_string) or die (mysql_error());\n\t\treturn $num_val;\n}", "public function setNumber($var) {}", "public function setNumber($var) {}", "public function setNumber($var) {}", "public function setNumber($var) {}", "function set_values(){\n echo $this->door_count = 10;\n }", "public function tbl_setAutoCierre($valor)\n\t{\n\t\t$this->_tbl_autocierre = $valor;\n\t\t$this->autotblx = $this->autotrx = $this->autotdx = $this->autothx = $valor;\n\t}", "public function setAncre($valeur) {$this->_ancre = $valeur;}", "public function getNumColegiado()\n {\n return $this->NumColegiado;\n }", "function setFidiOC(){\n\t\t$db=$this->db;\n\t\t$sql=\"UPDATE oneri.oneri_concessori SET fideiussione=coalesce((SELECT sum(totale-coalesce(versato,0)) FROM oneri.rate WHERE rata in (2,3) and pratica=$this->pratica),0) WHERE pratica=$this->pratica;\";\n $db->sql_query($sql);\n\t}", "public function asignarNivelDeficiencia()\n\t{\n\t\tif($this->evaluacion_riesgo_nivel_deficiencia==1)\n\t\t{\n\t\t\t$this->evaluacion_riesgo_nivel_deficiencia=2;\n\t\t}\n\t\telseif($this->evaluacion_riesgo_nivel_deficiencia==2)\n\t\t{\n\t\t\t$this->evaluacion_riesgo_nivel_deficiencia=6;\n\t\t}\n\t\tif($this->evaluacion_riesgo_nivel_deficiencia==3)\n\t\t{\n\t\t\t$this->evaluacion_riesgo_nivel_deficiencia=10;\n\t\t}\n\t}" ]
[ "0.6688926", "0.5720332", "0.5606264", "0.5545191", "0.52997947", "0.5275011", "0.52591467", "0.52432203", "0.5204734", "0.51446426", "0.51265", "0.511869", "0.5087956", "0.50808847", "0.5041834", "0.501593", "0.50107074", "0.500991", "0.49965084", "0.49844268", "0.4971992", "0.4971992", "0.4971992", "0.4971992", "0.497057", "0.49351102", "0.49344712", "0.49253654", "0.49113744", "0.49079254" ]
0.684126
0
This function tells if any element of the given collection satisfies a condition that is given in the callback.
function expression_function_any($collection, callable $callback) { if (!is_array($collection) && !$collection instanceof \Traversable) { throw new \InvalidArgumentException('$collection must be an array or Traversable object'); } foreach ($collection as $key => $item) { if ($callback($item, $key)) { return true; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function expression_function_all($collection, callable $callback)\n{\n if (!is_array($collection) && !$collection instanceof \\Traversable) {\n throw new \\InvalidArgumentException('$collection must be an array or Traversable object');\n }\n\n foreach ($collection as $key => $item) {\n if (!$callback($item, $key)) {\n return false;\n }\n }\n\n return true;\n}", "function some($iterable, $callback): bool {\n foreach ($iterable as $key => $value) {\n if ($callback($value, $key)) {\n return true;\n }\n }\n return false;\n}", "function array_some(array $collection = [], callable $iterator): bool {\n return array_any($collection, $iterator);\n}", "public function some(callable $callback)\n {\n $array = $this->getArrayCopy();\n foreach ($array as $key => $value) {\n if ($callback($value, $key, $array) === true) {\n return true;\n }\n }\n\n return false;\n }", "function any($arr, $callback) \n{\n foreach($arr as $key => $value) {\n if(is_callable($callback)) \n {\n\tif(call_user_func($callback, array($key, $value))) \n\t {\n\t return true;\n\t }\n } \n else if($value)\n {\n\t return true;\n }\n }\n return false;\n}", "function array_any(array $collection = [], callable $iterator): bool {\n // return (is_int(array_search(true, $collection, false)));\n foreach ($collection as $v) {\n if ($iterator($v)) {\n return true;\n }\n }\n return false;\n}", "public function forAll(Closure $func) {\n foreach ($this->_collection as $key => $element) {\n if (!$func($key, $element)) {\n return false;\n }\n }\n\n return true;\n }", "function every($iterable, $callback): bool {\n foreach ($iterable as $key => $value) {\n if (!$callback($value, $key)) {\n return false;\n }\n }\n return true;\n}", "public function every(callable $callback)\n {\n $array = $this->getArrayCopy();\n foreach ($array as $key => $value) {\n if ($callback($value, $key, $array) === false) {\n return false;\n }\n }\n\n return true;\n }", "function all($arr, $callback) \n{\n foreach($arr as $key => $value) \n {\n if(is_callable($callback)) \n {\n\tif(!call_user_func($callback, array($key, $value)))\n\t {\n\t return false;\n\t }\n } \n else if(!$value)\n\t{\n\t return false;\n\t}\n }\n return true;\n}", "function array_all(array $collection = [], callable $iterator): bool {\n foreach ($collection as $element) {\n if (!$iterator($element)) {\n return false;\n }\n }\n return true;\n}", "public function exists(Closure $p) {\n foreach ($this->_collection as $key => $element) {\n if ($p($key, $element)) {\n return true;\n }\n }\n return false;\n }", "function is_any(callable $callback, ...$values): bool\n {\n foreach ($values as $value) {\n if ((bool)call_user_func($callback, $value)) {\n return true;\n }\n }\n return false;\n }", "public function contains(callable $condition);", "public function any(callable $predicate);", "public function any(callable $predicate)\n {\n foreach ($this->each() as $k => $v) {\n if ($predicate($v, $k)) {\n return true;\n }\n }\n return false;\n }", "public function some(callable $predicate): bool\n {\n foreach ($this->intervals as $offset => $interval) {\n if (true === $predicate($interval, $offset)) {\n return true;\n }\n }\n\n return false;\n }", "public static function every(callable $checker, array $arr)\n {\n foreach ($arr as $item) {\n if (call_user_func($checker, $item) !== true) {\n return false;\n }\n }\n\n return true;\n }", "function any($predicate = null);", "function is_all(callable $callback, ...$values): bool\n {\n foreach ($values as $value) {\n if (!(bool)call_user_func($callback, $value)) {\n return false;\n }\n }\n return count($values) > 0;\n }", "public function anyMatch(callable $callable) : bool\n {\n $array = Arrays::of($this->collect())->filter($callable);\n return $array->length() > 0;\n }", "public function every(callable $condition);", "public static function checkAll($array, $callback)\n\t{\n\t\tforeach ($array as $k => $v) {\n\t\t\tif (!call_user_func($callback, $v, $k)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "function expression_function_filter($collection, callable $callback)\n{\n if (!is_array($collection) && !$collection instanceof \\Traversable) {\n throw new \\InvalidArgumentException('$collection must be an array or Traversable object');\n }\n\n foreach ($collection as $key => $value) {\n if ($callback($value)) {\n yield $key => $value;\n }\n }\n}", "function any($iterable)\n {\n foreach ($iterable as $element) {\n if ($element) {\n return true;\n }\n }\n return false;\n }", "public function all(callable $predicate): bool;", "public function each(callable $on_each, array $args=[]){\n foreach($this->storage as $elem){\n if(call_user_func_array($on_each, array_merge([$elem], $args)) === false){\n return false;\n }\n }\n return true;\n }", "function any(iterable $functions): Closure\n{\n return\n /**\n * @param mixed $value\n * @return bool\n */\n static function ($value) use ($functions): bool {\n foreach ($functions as $function) {\n if ($function($value)) {\n return true;\n }\n }\n\n return false;\n };\n}", "public static function matchesAny($array, Closure $closure)\n {\n // Reduce the array to only booleans\n $array = (array) ArraysMethods::each($array, $closure);\n\n // Check the results\n if (sizeof($array) === 0) {\n return true;\n }\n $array = array_search(true, $array, false);\n\n return is_int($array);\n }", "public function every(callable $predicament, array $argumentTemplate = [])\n {\n $callback = new Callback($predicament, $argumentTemplate);\n\n foreach ($this as $k => $v) {\n if (!$callback->executeWithKeyAndValue($k, $v)) {\n return false;\n }\n }\n\n return true;\n }" ]
[ "0.72714615", "0.7176732", "0.7126498", "0.7079223", "0.70263237", "0.7026311", "0.6760365", "0.66585505", "0.66509634", "0.65835905", "0.64997166", "0.64931536", "0.64550686", "0.64493835", "0.64419466", "0.6435299", "0.6384968", "0.6348273", "0.6329903", "0.6327789", "0.6268039", "0.62450755", "0.6162675", "0.6148263", "0.6129524", "0.6123866", "0.61195207", "0.6103042", "0.6083531", "0.60749507" ]
0.79379714
0
This function tells if all of the elements in the given collection satisfy a condition that is given in the callback.
function expression_function_all($collection, callable $callback) { if (!is_array($collection) && !$collection instanceof \Traversable) { throw new \InvalidArgumentException('$collection must be an array or Traversable object'); } foreach ($collection as $key => $item) { if (!$callback($item, $key)) { return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function expression_function_any($collection, callable $callback)\n{\n if (!is_array($collection) && !$collection instanceof \\Traversable) {\n throw new \\InvalidArgumentException('$collection must be an array or Traversable object');\n }\n\n foreach ($collection as $key => $item) {\n if ($callback($item, $key)) {\n return true;\n }\n }\n\n return false;\n}", "public function forAll(Closure $func) {\n foreach ($this->_collection as $key => $element) {\n if (!$func($key, $element)) {\n return false;\n }\n }\n\n return true;\n }", "function array_some(array $collection = [], callable $iterator): bool {\n return array_any($collection, $iterator);\n}", "public function every(callable $callback)\n {\n $array = $this->getArrayCopy();\n foreach ($array as $key => $value) {\n if ($callback($value, $key, $array) === false) {\n return false;\n }\n }\n\n return true;\n }", "function array_all(array $collection = [], callable $iterator): bool {\n foreach ($collection as $element) {\n if (!$iterator($element)) {\n return false;\n }\n }\n return true;\n}", "function some($iterable, $callback): bool {\n foreach ($iterable as $key => $value) {\n if ($callback($value, $key)) {\n return true;\n }\n }\n return false;\n}", "public function some(callable $callback)\n {\n $array = $this->getArrayCopy();\n foreach ($array as $key => $value) {\n if ($callback($value, $key, $array) === true) {\n return true;\n }\n }\n\n return false;\n }", "function all($arr, $callback) \n{\n foreach($arr as $key => $value) \n {\n if(is_callable($callback)) \n {\n\tif(!call_user_func($callback, array($key, $value)))\n\t {\n\t return false;\n\t }\n } \n else if(!$value)\n\t{\n\t return false;\n\t}\n }\n return true;\n}", "function every($iterable, $callback): bool {\n foreach ($iterable as $key => $value) {\n if (!$callback($value, $key)) {\n return false;\n }\n }\n return true;\n}", "public function all(callable $predicate): bool;", "function is_all(callable $callback, ...$values): bool\n {\n foreach ($values as $value) {\n if (!(bool)call_user_func($callback, $value)) {\n return false;\n }\n }\n return count($values) > 0;\n }", "public static function every(callable $checker, array $arr)\n {\n foreach ($arr as $item) {\n if (call_user_func($checker, $item) !== true) {\n return false;\n }\n }\n\n return true;\n }", "public function every(callable $condition);", "function array_any(array $collection = [], callable $iterator): bool {\n // return (is_int(array_search(true, $collection, false)));\n foreach ($collection as $v) {\n if ($iterator($v)) {\n return true;\n }\n }\n return false;\n}", "public static function checkAll($array, $callback)\n\t{\n\t\tforeach ($array as $k => $v) {\n\t\t\tif (!call_user_func($callback, $v, $k)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "function any($arr, $callback) \n{\n foreach($arr as $key => $value) {\n if(is_callable($callback)) \n {\n\tif(call_user_func($callback, array($key, $value))) \n\t {\n\t return true;\n\t }\n } \n else if($value)\n {\n\t return true;\n }\n }\n return false;\n}", "public function all(callable $predicate)\n {\n foreach ($this->each() as $k => $v) {\n if (! $predicate($v, $k)) {\n return false;\n }\n }\n return true;\n }", "public function each(callable $on_each, array $args=[]){\n foreach($this->storage as $elem){\n if(call_user_func_array($on_each, array_merge([$elem], $args)) === false){\n return false;\n }\n }\n return true;\n }", "public function containsAll(CollectionInterface $collection): bool;", "public function allMatch(callable $callable) : bool\n {\n $array = Arrays::of($this->collect())->filter($callable);\n return $array->length() == $this->length();\n }", "static function find_all($collection, $predicate){\n\t\t$found = [];\n\t\tif(is_object($predicate) && ($predicate instanceof Closure)){\n\t\t\tforeach($collection as $item){\n\t\t\t\tif($predicate($item)){\n\t\t\t\t\t$found[] = $item;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\tif(is_array($predicate)){\n\t\t\t\tforeach($collection as $item){\n\t\t\t\t\tforeach($predicate as $k_match => $v_match){\n\t\t\t\t\t\tif(!array_key_exists($k_match, $item) || $item[$k_match] != $v_match){\n\t\t\t\t\t\t\tcontinue 2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$found[] = $item;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tforeach($collection as $item){\n\t\t\t\t\tif(array_key_exists($predicate, $item)){\n\t\t\t\t\t\t$found[] = $item;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $found;\n\t}", "function all($predicate);", "public function every(callable $predicate): bool\n {\n foreach ($this->intervals as $offset => $interval) {\n if (true !== $predicate($interval, $offset)) {\n return false;\n }\n }\n\n return [] !== $this->intervals;\n }", "public function some(callable $predicate): bool\n {\n foreach ($this->intervals as $offset => $interval) {\n if (true === $predicate($interval, $offset)) {\n return true;\n }\n }\n\n return false;\n }", "public function contains(callable $condition);", "public function any(callable $predicate)\n {\n foreach ($this->each() as $k => $v) {\n if ($predicate($v, $k)) {\n return true;\n }\n }\n return false;\n }", "public function all(callable $predicate);", "public function anyMatch(callable $callable) : bool\n {\n $array = Arrays::of($this->collect())->filter($callable);\n return $array->length() > 0;\n }", "function is_any(callable $callback, ...$values): bool\n {\n foreach ($values as $value) {\n if ((bool)call_user_func($callback, $value)) {\n return true;\n }\n }\n return false;\n }", "public static function any(callable $fCheck, iterable $values): bool\n {\n foreach ($values as $value) {\n if ($fCheck($value)) {\n return true;\n }\n }\n\n return false;\n }" ]
[ "0.73720545", "0.6763368", "0.67226815", "0.6696263", "0.66950786", "0.6668623", "0.6651191", "0.66498864", "0.66469985", "0.6568299", "0.654698", "0.6513483", "0.65001714", "0.6472088", "0.6419157", "0.6417871", "0.63659936", "0.62908226", "0.62607086", "0.6208901", "0.60949594", "0.60885984", "0.60573775", "0.6033938", "0.6017668", "0.60086834", "0.6005654", "0.5996594", "0.59865546", "0.595155" ]
0.72362274
1
This function returns the first element in the given collection that satisfy a condition given in the callback.
function expression_function_first($collection, callable $callback) { if (!is_array($collection) && !$collection instanceof \Traversable) { throw new \InvalidArgumentException('$collection must be an array or Traversable object'); } foreach ($collection as $key => $item) { if ($callback($item, $key)) { return $item; } } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function findFirst(callable $condition)\n {\n return current(array_filter($this->items, $condition));\n }", "function find(array $list, callable $predicate, $default = null)\n{\n foreach ($list as $item) {\n if ($predicate($item)) {\n return $item;\n }\n }\n\n return $default;\n}", "function find(callable $predicate, Listt $list): Maybe\n{\n foreach ($list as $item)\n {\n if ($predicate($item))\n {\n return just($item);\n }\n }\n return nothing();\n}", "function find($iterable, $callback) {\n foreach ($iterable as $key => $value) {\n if ($callback($value, $key)) {\n return $value;\n }\n }\n return null;\n}", "public function find(callable $callback)\n {\n $array = $this->getArrayCopy();\n foreach ($array as $key => $value) {\n if ($callback($value, $key, $array) === true) {\n return $value;\n }\n }\n }", "public function find(callable $condition);", "function array_find_first(array $array, callable $callback = null, $default = null) {\n if (is_null($callback)) {\n if (empty($array)) {\n return $default;\n }\n foreach ($array as $item) {\n return $item;\n }\n }\n foreach ($array as $key => $value) {\n if ($callback && call_user_func($callback, $value, $key)) {\n return $value;\n }\n }\n return $default;\n}", "function first($array, $callback, $default = null)\n {\n foreach ($array as $key => $value) {\n if (call_user_func($callback, $key, $value)) return $value;\n }\n\n return value($default);\n }", "function first($coll)\n{\n foreach ($coll as $item) {\n return $item;\n }\n}", "function first($array, $callback, $default = null)\n {\n foreach ($array as $key => $value)\n {\n if (call_user_func($callback, $key, $value)) return $value;\n }\n\n return value($default);\n }", "function search(callable $fn, iterable $coll, $default = null)\n{\n foreach ($coll as $key => $value) {\n if ($fn($value, $key)) {\n return $value;\n }\n }\n\n return $default;\n}", "public static function first($array, $callback, $default = null)\n {\n foreach ($array as $key => $value) {\n if (call_user_func($callback, $key, $value)) {\n return $value;\n }\n }\n\n return $default;\n }", "public function findValue(callable $callback): mixed\n {\n foreach ($this->items as $key => $value) {\n if ($callback($value, $key)) {\n return $value;\n }\n }\n\n return null;\n }", "public function findItems(callable $callback)\n {\n $result = array_filter(\n $this->data,\n function (ClientObject $item) use ($callback) {\n return call_user_func($callback, $item);\n }\n );\n if (count($result) > 0)\n return array_values($result);\n return null;\n }", "function array_first($array, $callback, $default = null)\n {\n foreach ($array as $key => $value) {\n if (call_user_func($callback, $key, $value)) return $value;\n }\n\n return value($default);\n }", "public function first()\n {\n $this->limit(1);\n $results = call_user_func_array(array($this, 'get'), func_get_args());\n if($results)\n return array_shift($results);\n return false;\n }", "function array_first($array, $callback, $default = null)\n {\n foreach ($array as $key => $value)\n {\n if (call_user_func($callback, $key, $value)) return $value;\n }\n\n return value($default);\n }", "public static function first($array, callable $callback = null, $default = null)\n {\n if (is_null($callback)) {\n if (empty($array)) {\n return self::value($default);\n }\n\n foreach ($array as $item) {\n return $item;\n }\n }\n\n foreach ($array as $key => $value) {\n if ($callback($value, $key)) {\n return $value;\n }\n }\n\n return self::value($default);\n }", "public static function first($array, callable $callback = null, $default = null)\n {\n if (is_null($callback)) {\n if (empty($array)) {\n return value($default);\n }\n\n foreach ($array as $item) {\n return $item;\n }\n }\n\n foreach ($array as $key => $value) {\n if ($callback($value, $key)) {\n return $value;\n }\n }\n\n return value($default);\n }", "function firstOrDefault($predicateOrDefValue = null, $defValue = null);", "public function first(Closure $callback = null, $default = null)\n {\n if (is_null($callback)) {\n return count($this->items) > 0 ? reset($this->items) : null;\n }\n return static::array_first($this->items, $callback, $default);\n }", "public static function first($array, callable $callback = null, $default = null)\n\t{\n\t\tif (is_null($callback)) {\n\t\t\tif (count($array) === 0)\n\t\t\t\treturn value($default);\n\n\t\t\tforeach ($array as $item)\n\t\t\t\treturn $item;\n\t\t}\n\n\t\tforeach ($array as $key => $value) {\n\t\t\tif (call_user_func($callback, $key, $value)) {\n\t\t\t\treturn $value;\n\t\t\t}\n\t\t}\n\n\t\treturn value($default);\n\t}", "public static function first(iterable $array, callable $callback = null, mixed $default = null): mixed\n {\n if (is_null($callback)) {\n if (empty($array)) {\n return Helpers::value($default);\n }\n\n foreach ($array as $item) {\n return $item;\n }\n }\n\n foreach ($array as $key => $value) {\n if ($callback($value, $key)) {\n return $value;\n }\n }\n\n return Helpers::value($default);\n }", "public function findFirst($key, $value)\n {\n $result = $this->findItems(\n function (ClientObject $item) use ($key, $value) {\n return $item->getProperty($key) === $value;\n });\n return (is_array($result) && (count($result) > 0) ? array_values($result)[0] : null);\n }", "public function find($collection, array $filter)\n {\n $result = $this->where($collection, $filter)->toArray();\n\n if (!empty($result))\n return $result[0];\n\n return null;\n }", "public static function first($array, callable $callback = null, $default = null)\n {\n if (is_null($callback)) {\n return empty($array) ? value($default) : reset($array);\n }\n\n foreach ($array as $key => $value) {\n if (call_user_func($callback, $key, $value)) {\n return $value;\n }\n }\n\n return value($default);\n }", "public function first(callable $predicate = null);", "public static function first(callable $test, iterable $items, $default)\n {\n foreach ($items as $item) {\n if ($test($item)) {\n return $item;\n }\n }\n\n return $default;\n }", "public static function find($array, Closure $closure)\n {\n foreach ($array as $key => $value) {\n if ($closure($value, $key)) {\n return $value;\n }\n }\n\n return null;\n }", "public static function findIf($iter, $callback)\n {\n foreach ($iter as $item) {\n if ($callback($item)) {\n return $item;\n }\n }\n\n return false;\n }" ]
[ "0.75807256", "0.70989084", "0.69555813", "0.67435133", "0.6656307", "0.65768784", "0.65023154", "0.64677525", "0.64610445", "0.64530987", "0.64465624", "0.6159658", "0.6128628", "0.60798013", "0.60761034", "0.6074834", "0.6068504", "0.60587704", "0.60094535", "0.59537464", "0.5927491", "0.5920497", "0.590897", "0.58948046", "0.58939296", "0.58891845", "0.58889467", "0.58850414", "0.58796203", "0.58620876" ]
0.76657635
0
Add Call to Action options to elements page
function mixtape_qodef_call_to_action_options_map() { $panel_call_to_action = mixtape_qodef_add_admin_panel( array( 'page' => '_elements_page', 'name' => 'panel_call_to_action', 'title' => esc_html__('Call To Action', 'mixtapewp') ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function careerfy_vc_call_to_action()\n{\n $attributes = array(\n \"name\" => esc_html__(\"Call to Action\", \"careerfy-frame\"),\n \"base\" => \"careerfy_call_to_action\",\n \"category\" => esc_html__(\"Careerfy Theme\", \"careerfy-frame\"),\n \"class\" => \"\",\n \"params\" => array(\n array(\n 'type' => 'dropdown',\n 'heading' => esc_html__(\"View\", \"careerfy-frame\"),\n 'param_name' => 'view',\n 'value' => array(\n esc_html__(\"View 1\", \"careerfy-frame\") => 'view-1',\n esc_html__(\"View 2\", \"careerfy-frame\") => 'view-2',\n esc_html__(\"View 3\", \"careerfy-frame\") => 'view-3',\n esc_html__(\"View 4\", \"careerfy-frame\") => 'view-4',\n esc_html__(\"View 5\", \"careerfy-frame\") => 'view-5',\n ),\n 'description' => ''\n ),\n array(\n 'type' => 'careerfy_browse_img',\n 'heading' => esc_html__(\"Image\", \"careerfy-frame\"),\n 'param_name' => 'cta_img',\n 'value' => '',\n 'description' => '',\n 'dependency' => array(\n 'element' => 'view',\n 'value' => array('view-1', 'view-2')\n ),\n ),\n array(\n 'type' => 'textfield',\n 'heading' => esc_html__(\"Title 1\", \"careerfy-frame\"),\n 'param_name' => 'cta_title1',\n 'value' => '',\n 'description' => ''\n ),\n array(\n 'type' => 'textfield',\n 'heading' => esc_html__(\"Title 2\", \"careerfy-frame\"),\n 'param_name' => 'cta_title2',\n 'value' => '',\n 'description' => '',\n 'dependency' => array(\n 'element' => 'view',\n 'value' => array('view-1', 'view-2', 'view-4')\n ),\n ),\n array(\n 'type' => 'textfield',\n 'heading' => esc_html__(\"Small Title\", \"careerfy-frame\"),\n 'param_name' => 'cta_title_small',\n 'value' => '',\n 'description' => '',\n 'dependency' => array(\n 'element' => 'view',\n 'value' => array('view-3')\n ),\n\n ),\n array(\n 'type' => 'textarea',\n 'heading' => esc_html__(\"Description\", \"careerfy-frame\"),\n 'param_name' => 'cta_desc',\n 'value' => '',\n 'description' => '',\n 'dependency' => array(\n 'element' => 'view',\n 'value' => array('view-1', 'view-2', 'view-5')\n ),\n ),\n array(\n 'type' => 'textfield',\n 'heading' => esc_html__(\"Button Text\", \"careerfy-frame\"),\n 'param_name' => 'btn_txt',\n 'value' => '',\n 'description' => ''\n ),\n array(\n 'type' => 'textfield',\n 'heading' => esc_html__(\"Button URL\", \"careerfy-frame\"),\n 'param_name' => 'btn_url',\n 'value' => '',\n 'description' => ''\n ),\n array(\n 'type' => 'textfield',\n 'heading' => esc_html__(\"Button Text 2\", \"careerfy-frame\"),\n 'param_name' => 'btn_txt_2',\n 'value' => '',\n 'description' => ''\n ),\n array(\n 'type' => 'textfield',\n 'heading' => esc_html__(\"Button URL 2\", \"careerfy-frame\"),\n 'param_name' => 'btn_url_2',\n 'value' => '',\n 'description' => ''\n ),\n )\n );\n\n if (function_exists('vc_map')) {\n vc_map($attributes);\n }\n}", "function SetupOtherOptions() {\n\t\tglobal $Language, $Security;\n\t\t$options = &$this->OtherOptions;\n\t\t$option = &$options[\"action\"];\n\n\t\t// Add\n\t\t$item = &$option->Add(\"add\");\n\t\t$item->Body = \"<a class=\\\"ewAction ewAdd\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageAddLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageAddLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->AddUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageAddLink\") . \"</a>\";\n\t\t$item->Visible = ($this->AddUrl <> \"\" && $Security->CanAdd());\n\n\t\t// Edit\n\t\t$item = &$option->Add(\"edit\");\n\t\t$item->Body = \"<a class=\\\"ewAction ewEdit\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageEditLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageEditLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->EditUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageEditLink\") . \"</a>\";\n\t\t$item->Visible = ($this->EditUrl <> \"\" && $Security->CanEdit());\n\n\t\t// Copy\n\t\t$item = &$option->Add(\"copy\");\n\t\t$item->Body = \"<a class=\\\"ewAction ewCopy\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageCopyLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageCopyLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->CopyUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageCopyLink\") . \"</a>\";\n\t\t$item->Visible = ($this->CopyUrl <> \"\" && $Security->CanAdd());\n\n\t\t// Delete\n\t\t$item = &$option->Add(\"delete\");\n\t\t$item->Body = \"<a onclick=\\\"return ew_Confirm(ewLanguage.Phrase('DeleteConfirmMsg'));\\\" class=\\\"ewAction ewDelete\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->DeleteUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageDeleteLink\") . \"</a>\";\n\t\t$item->Visible = ($this->DeleteUrl <> \"\" && $Security->CanDelete());\n\n\t\t// Show detail edit/copy\n\t\tif ($this->getCurrentDetailTable() <> \"\") {\n\n\t\t\t// Detail Edit\n\t\t\t$item = &$option->Add(\"detailedit\");\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewDetailEdit\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailEditLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailEditLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->GetEditUrl(EW_TABLE_SHOW_DETAIL . \"=\" . $this->getCurrentDetailTable())) . \"\\\">\" . $Language->Phrase(\"MasterDetailEditLink\") . \"</a>\";\n\t\t\t$item->Visible = ($Security->CanEdit());\n\n\t\t\t// Detail Copy\n\t\t\t$item = &$option->Add(\"detailcopy\");\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewDetailCopy\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailCopyLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailCopyLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->GetCopyUrl(EW_TABLE_SHOW_DETAIL . \"=\" . $this->getCurrentDetailTable())) . \"\\\">\" . $Language->Phrase(\"MasterDetailCopyLink\") . \"</a>\";\n\t\t\t$item->Visible = ($Security->CanAdd());\n\t\t}\n\t\t$option = &$options[\"detail\"];\n\t\t$DetailTableLink = \"\";\n\t\t$DetailViewTblVar = \"\";\n\t\t$DetailCopyTblVar = \"\";\n\t\t$DetailEditTblVar = \"\";\n\n\t\t// \"detail_job_candidates\"\n\t\t$item = &$option->Add(\"detail_job_candidates\");\n\t\t$body = $Language->Phrase(\"DetailLink\") . $Language->TablePhrase(\"job_candidates\", \"TblCaption\");\n\t\t$body .= str_replace(\"%c\", $this->job_candidates_Count, $Language->Phrase(\"DetailCount\"));\n\t\t$body = \"<a class=\\\"btn btn-default btn-sm ewRowLink ewDetail\\\" data-action=\\\"list\\\" href=\\\"\" . ew_HtmlEncode(\"job_candidateslist.php?\" . EW_TABLE_SHOW_MASTER . \"=jobs&fk_id=\" . strval($this->id->CurrentValue) . \"\") . \"\\\">\" . $body . \"</a>\";\n\t\t$links = \"\";\n\t\tif ($GLOBALS[\"job_candidates_grid\"] && $GLOBALS[\"job_candidates_grid\"]->DetailView && $Security->CanView() && $Security->AllowView(CurrentProjectID() . 'job_candidates')) {\n\t\t\t$links .= \"<li><a class=\\\"ewRowLink ewDetailView\\\" data-action=\\\"view\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailViewLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->GetViewUrl(EW_TABLE_SHOW_DETAIL . \"=job_candidates\")) . \"\\\">\" . ew_HtmlImageAndText($Language->Phrase(\"MasterDetailViewLink\")) . \"</a></li>\";\n\t\t\tif ($DetailViewTblVar <> \"\") $DetailViewTblVar .= \",\";\n\t\t\t$DetailViewTblVar .= \"job_candidates\";\n\t\t}\n\t\tif ($GLOBALS[\"job_candidates_grid\"] && $GLOBALS[\"job_candidates_grid\"]->DetailEdit && $Security->CanEdit() && $Security->AllowEdit(CurrentProjectID() . 'job_candidates')) {\n\t\t\t$links .= \"<li><a class=\\\"ewRowLink ewDetailEdit\\\" data-action=\\\"edit\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailEditLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->GetEditUrl(EW_TABLE_SHOW_DETAIL . \"=job_candidates\")) . \"\\\">\" . ew_HtmlImageAndText($Language->Phrase(\"MasterDetailEditLink\")) . \"</a></li>\";\n\t\t\tif ($DetailEditTblVar <> \"\") $DetailEditTblVar .= \",\";\n\t\t\t$DetailEditTblVar .= \"job_candidates\";\n\t\t}\n\t\tif ($GLOBALS[\"job_candidates_grid\"] && $GLOBALS[\"job_candidates_grid\"]->DetailAdd && $Security->CanAdd() && $Security->AllowAdd(CurrentProjectID() . 'job_candidates')) {\n\t\t\t$links .= \"<li><a class=\\\"ewRowLink ewDetailCopy\\\" data-action=\\\"add\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailCopyLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->GetCopyUrl(EW_TABLE_SHOW_DETAIL . \"=job_candidates\")) . \"\\\">\" . ew_HtmlImageAndText($Language->Phrase(\"MasterDetailCopyLink\")) . \"</a></li>\";\n\t\t\tif ($DetailCopyTblVar <> \"\") $DetailCopyTblVar .= \",\";\n\t\t\t$DetailCopyTblVar .= \"job_candidates\";\n\t\t}\n\t\tif ($links <> \"\") {\n\t\t\t$body .= \"<button class=\\\"dropdown-toggle btn btn-default btn-sm ewDetail\\\" data-toggle=\\\"dropdown\\\"><b class=\\\"caret\\\"></b></button>\";\n\t\t\t$body .= \"<ul class=\\\"dropdown-menu\\\">\". $links . \"</ul>\";\n\t\t}\n\t\t$body = \"<div class=\\\"btn-group\\\">\" . $body . \"</div>\";\n\t\t$item->Body = $body;\n\t\t$item->Visible = $Security->AllowList(CurrentProjectID() . 'job_candidates');\n\t\tif ($item->Visible) {\n\t\t\tif ($DetailTableLink <> \"\") $DetailTableLink .= \",\";\n\t\t\t$DetailTableLink .= \"job_candidates\";\n\t\t}\n\t\tif ($this->ShowMultipleDetails) $item->Visible = FALSE;\n\n\t\t// Multiple details\n\t\tif ($this->ShowMultipleDetails) {\n\t\t\t$body = $Language->Phrase(\"MultipleMasterDetails\");\n\t\t\t$body = \"<div class=\\\"btn-group\\\">\";\n\t\t\t$links = \"\";\n\t\t\tif ($DetailViewTblVar <> \"\") {\n\t\t\t\t$links .= \"<li><a class=\\\"ewRowLink ewDetailView\\\" data-action=\\\"view\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailViewLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->GetViewUrl(EW_TABLE_SHOW_DETAIL . \"=\" . $DetailViewTblVar)) . \"\\\">\" . ew_HtmlImageAndText($Language->Phrase(\"MasterDetailViewLink\")) . \"</a></li>\";\n\t\t\t}\n\t\t\tif ($DetailEditTblVar <> \"\") {\n\t\t\t\t$links .= \"<li><a class=\\\"ewRowLink ewDetailEdit\\\" data-action=\\\"edit\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailEditLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->GetEditUrl(EW_TABLE_SHOW_DETAIL . \"=\" . $DetailEditTblVar)) . \"\\\">\" . ew_HtmlImageAndText($Language->Phrase(\"MasterDetailEditLink\")) . \"</a></li>\";\n\t\t\t}\n\t\t\tif ($DetailCopyTblVar <> \"\") {\n\t\t\t\t$links .= \"<li><a class=\\\"ewRowLink ewDetailCopy\\\" data-action=\\\"add\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MasterDetailCopyLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->GetCopyUrl(EW_TABLE_SHOW_DETAIL . \"=\" . $DetailCopyTblVar)) . \"\\\">\" . ew_HtmlImageAndText($Language->Phrase(\"MasterDetailCopyLink\")) . \"</a></li>\";\n\t\t\t}\n\t\t\tif ($links <> \"\") {\n\t\t\t\t$body .= \"<button class=\\\"dropdown-toggle btn btn-default btn-sm ewMasterDetail\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"MultipleMasterDetails\")) . \"\\\" data-toggle=\\\"dropdown\\\">\" . $Language->Phrase(\"MultipleMasterDetails\") . \"<b class=\\\"caret\\\"></b></button>\";\n\t\t\t\t$body .= \"<ul class=\\\"dropdown-menu ewMenu\\\">\". $links . \"</ul>\";\n\t\t\t}\n\t\t\t$body .= \"</div>\";\n\n\t\t\t// Multiple details\n\t\t\t$oListOpt = &$option->Add(\"details\");\n\t\t\t$oListOpt->Body = $body;\n\t\t}\n\n\t\t// Set up detail default\n\t\t$option = &$options[\"detail\"];\n\t\t$options[\"detail\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonDetails\");\n\t\t$option->UseImageAndText = TRUE;\n\t\t$ar = explode(\",\", $DetailTableLink);\n\t\t$cnt = count($ar);\n\t\t$option->UseDropDownButton = ($cnt > 1);\n\t\t$option->UseButtonGroup = TRUE;\n\t\t$item = &$option->Add($option->GroupOptionName);\n\t\t$item->Body = \"\";\n\t\t$item->Visible = FALSE;\n\n\t\t// Set up action default\n\t\t$option = &$options[\"action\"];\n\t\t$option->DropDownButtonPhrase = $Language->Phrase(\"ButtonActions\");\n\t\t$option->UseImageAndText = TRUE;\n\t\t$option->UseDropDownButton = FALSE;\n\t\t$option->UseButtonGroup = TRUE;\n\t\t$item = &$option->Add($option->GroupOptionName);\n\t\t$item->Body = \"\";\n\t\t$item->Visible = FALSE;\n\t}", "function SetupOtherOptions() {\n\t\tglobal $Language, $Security;\n\t\t$options = &$this->OtherOptions;\n\t\t$option = &$options[\"action\"];\n\n\t\t// Add\n\t\t$item = &$option->Add(\"add\");\n\t\t$addcaption = ew_HtmlTitle($Language->Phrase(\"ViewPageAddLink\"));\n\t\tif ($this->IsModal) // Modal\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewAdd\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"javascript:void(0);\\\" onclick=\\\"ew_ModalDialogShow({lnk:this,url:'\" . ew_HtmlEncode($this->AddUrl) . \"',caption:'\" . $addcaption . \"'});\\\">\" . $Language->Phrase(\"ViewPageAddLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewAdd\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->AddUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageAddLink\") . \"</a>\";\n\t\t$item->Visible = ($this->AddUrl <> \"\");\n\n\t\t// Edit\n\t\t$item = &$option->Add(\"edit\");\n\t\t$editcaption = ew_HtmlTitle($Language->Phrase(\"ViewPageEditLink\"));\n\t\tif ($this->IsModal) // Modal\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewEdit\\\" title=\\\"\" . $editcaption . \"\\\" data-caption=\\\"\" . $editcaption . \"\\\" href=\\\"javascript:void(0);\\\" onclick=\\\"ew_ModalDialogShow({lnk:this,url:'\" . ew_HtmlEncode($this->EditUrl) . \"',caption:'\" . $editcaption . \"'});\\\">\" . $Language->Phrase(\"ViewPageEditLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewEdit\\\" title=\\\"\" . $editcaption . \"\\\" data-caption=\\\"\" . $editcaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->EditUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageEditLink\") . \"</a>\";\n\t\t$item->Visible = ($this->EditUrl <> \"\");\n\n\t\t// Copy\n\t\t$item = &$option->Add(\"copy\");\n\t\t$copycaption = ew_HtmlTitle($Language->Phrase(\"ViewPageCopyLink\"));\n\t\tif ($this->IsModal) // Modal\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewCopy\\\" title=\\\"\" . $copycaption . \"\\\" data-caption=\\\"\" . $copycaption . \"\\\" href=\\\"javascript:void(0);\\\" onclick=\\\"ew_ModalDialogShow({lnk:this,url:'\" . ew_HtmlEncode($this->CopyUrl) . \"',caption:'\" . $copycaption . \"'});\\\">\" . $Language->Phrase(\"ViewPageCopyLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewCopy\\\" title=\\\"\" . $copycaption . \"\\\" data-caption=\\\"\" . $copycaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->CopyUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageCopyLink\") . \"</a>\";\n\t\t$item->Visible = ($this->CopyUrl <> \"\");\n\n\t\t// Delete\n\t\t$item = &$option->Add(\"delete\");\n\t\tif ($this->IsModal) // Handle as inline delete\n\t\t\t$item->Body = \"<a onclick=\\\"return ew_ConfirmDelete(this);\\\" class=\\\"ewAction ewDelete\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode(ew_AddQueryStringToUrl($this->DeleteUrl, \"a_delete=1\")) . \"\\\">\" . $Language->Phrase(\"ViewPageDeleteLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewDelete\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->DeleteUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageDeleteLink\") . \"</a>\";\n\t\t$item->Visible = ($this->DeleteUrl <> \"\");\n\n\t\t// Set up action default\n\t\t$option = &$options[\"action\"];\n\t\t$option->DropDownButtonPhrase = $Language->Phrase(\"ButtonActions\");\n\t\t$option->UseImageAndText = TRUE;\n\t\t$option->UseDropDownButton = FALSE;\n\t\t$option->UseButtonGroup = TRUE;\n\t\t$item = &$option->Add($option->GroupOptionName);\n\t\t$item->Body = \"\";\n\t\t$item->Visible = FALSE;\n\t}", "function SetupOtherOptions() {\n\t\tglobal $Language, $Security;\n\t\t$options = &$this->OtherOptions;\n\t\t$option = &$options[\"action\"];\n\n\t\t// Add\n\t\t$item = &$option->Add(\"add\");\n\t\t$addcaption = ew_HtmlTitle($Language->Phrase(\"ViewPageAddLink\"));\n\t\tif ($this->IsModal) // Modal\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewAdd\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"javascript:void(0);\\\" onclick=\\\"ew_ModalDialogShow({lnk:this,url:'\" . ew_HtmlEncode($this->AddUrl) . \"',caption:'\" . $addcaption . \"'});\\\">\" . $Language->Phrase(\"ViewPageAddLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewAdd\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->AddUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageAddLink\") . \"</a>\";\n\t\t$item->Visible = ($this->AddUrl <> \"\" && $Security->CanAdd());\n\n\t\t// Edit\n\t\t$item = &$option->Add(\"edit\");\n\t\t$editcaption = ew_HtmlTitle($Language->Phrase(\"ViewPageEditLink\"));\n\t\tif ($this->IsModal) // Modal\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewEdit\\\" title=\\\"\" . $editcaption . \"\\\" data-caption=\\\"\" . $editcaption . \"\\\" href=\\\"javascript:void(0);\\\" onclick=\\\"ew_ModalDialogShow({lnk:this,url:'\" . ew_HtmlEncode($this->EditUrl) . \"',caption:'\" . $editcaption . \"'});\\\">\" . $Language->Phrase(\"ViewPageEditLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewEdit\\\" title=\\\"\" . $editcaption . \"\\\" data-caption=\\\"\" . $editcaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->EditUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageEditLink\") . \"</a>\";\n\t\t$item->Visible = ($this->EditUrl <> \"\" && $Security->CanEdit());\n\n\t\t// Copy\n\t\t$item = &$option->Add(\"copy\");\n\t\t$copycaption = ew_HtmlTitle($Language->Phrase(\"ViewPageCopyLink\"));\n\t\tif ($this->IsModal) // Modal\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewCopy\\\" title=\\\"\" . $copycaption . \"\\\" data-caption=\\\"\" . $copycaption . \"\\\" href=\\\"javascript:void(0);\\\" onclick=\\\"ew_ModalDialogShow({lnk:this,url:'\" . ew_HtmlEncode($this->CopyUrl) . \"',caption:'\" . $copycaption . \"'});\\\">\" . $Language->Phrase(\"ViewPageCopyLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewCopy\\\" title=\\\"\" . $copycaption . \"\\\" data-caption=\\\"\" . $copycaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->CopyUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageCopyLink\") . \"</a>\";\n\t\t$item->Visible = ($this->CopyUrl <> \"\" && $Security->CanAdd());\n\n\t\t// Delete\n\t\t$item = &$option->Add(\"delete\");\n\t\tif ($this->IsModal) // Handle as inline delete\n\t\t\t$item->Body = \"<a onclick=\\\"return ew_ConfirmDelete(this);\\\" class=\\\"ewAction ewDelete\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode(ew_AddQueryStringToUrl($this->DeleteUrl, \"a_delete=1\")) . \"\\\">\" . $Language->Phrase(\"ViewPageDeleteLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewDelete\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->DeleteUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageDeleteLink\") . \"</a>\";\n\t\t$item->Visible = ($this->DeleteUrl <> \"\" && $Security->CanDelete());\n\n\t\t// Set up action default\n\t\t$option = &$options[\"action\"];\n\t\t$option->DropDownButtonPhrase = $Language->Phrase(\"ButtonActions\");\n\t\t$option->UseImageAndText = TRUE;\n\t\t$option->UseDropDownButton = FALSE;\n\t\t$option->UseButtonGroup = TRUE;\n\t\t$item = &$option->Add($option->GroupOptionName);\n\t\t$item->Body = \"\";\n\t\t$item->Visible = FALSE;\n\t}", "function SetupOtherOptions() {\n\t\tglobal $Language, $Security;\n\t\t$options = &$this->OtherOptions;\n\t\t$option = &$options[\"action\"];\n\n\t\t// Add\n\t\t$item = &$option->Add(\"add\");\n\t\t$addcaption = ew_HtmlTitle($Language->Phrase(\"ViewPageAddLink\"));\n\t\tif ($this->IsModal) // Modal\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewAdd\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"javascript:void(0);\\\" onclick=\\\"ew_ModalDialogShow({lnk:this,url:'\" . ew_HtmlEncode($this->AddUrl) . \"',caption:'\" . $addcaption . \"'});\\\">\" . $Language->Phrase(\"ViewPageAddLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewAdd\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->AddUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageAddLink\") . \"</a>\";\n\t\t$item->Visible = ($this->AddUrl <> \"\" && $Security->IsLoggedIn());\n\n\t\t// Edit\n\t\t$item = &$option->Add(\"edit\");\n\t\t$editcaption = ew_HtmlTitle($Language->Phrase(\"ViewPageEditLink\"));\n\t\tif ($this->IsModal) // Modal\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewEdit\\\" title=\\\"\" . $editcaption . \"\\\" data-caption=\\\"\" . $editcaption . \"\\\" href=\\\"javascript:void(0);\\\" onclick=\\\"ew_ModalDialogShow({lnk:this,url:'\" . ew_HtmlEncode($this->EditUrl) . \"',caption:'\" . $editcaption . \"'});\\\">\" . $Language->Phrase(\"ViewPageEditLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewEdit\\\" title=\\\"\" . $editcaption . \"\\\" data-caption=\\\"\" . $editcaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->EditUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageEditLink\") . \"</a>\";\n\t\t$item->Visible = ($this->EditUrl <> \"\" && $Security->IsLoggedIn());\n\n\t\t// Copy\n\t\t$item = &$option->Add(\"copy\");\n\t\t$copycaption = ew_HtmlTitle($Language->Phrase(\"ViewPageCopyLink\"));\n\t\tif ($this->IsModal) // Modal\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewCopy\\\" title=\\\"\" . $copycaption . \"\\\" data-caption=\\\"\" . $copycaption . \"\\\" href=\\\"javascript:void(0);\\\" onclick=\\\"ew_ModalDialogShow({lnk:this,url:'\" . ew_HtmlEncode($this->CopyUrl) . \"',caption:'\" . $copycaption . \"'});\\\">\" . $Language->Phrase(\"ViewPageCopyLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewCopy\\\" title=\\\"\" . $copycaption . \"\\\" data-caption=\\\"\" . $copycaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->CopyUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageCopyLink\") . \"</a>\";\n\t\t$item->Visible = ($this->CopyUrl <> \"\" && $Security->IsLoggedIn());\n\n\t\t// Delete\n\t\t$item = &$option->Add(\"delete\");\n\t\tif ($this->IsModal) // Handle as inline delete\n\t\t\t$item->Body = \"<a onclick=\\\"return ew_ConfirmDelete(this);\\\" class=\\\"ewAction ewDelete\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode(ew_AddQueryStringToUrl($this->DeleteUrl, \"a_delete=1\")) . \"\\\">\" . $Language->Phrase(\"ViewPageDeleteLink\") . \"</a>\";\n\t\telse\n\t\t\t$item->Body = \"<a class=\\\"ewAction ewDelete\\\" title=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" data-caption=\\\"\" . ew_HtmlTitle($Language->Phrase(\"ViewPageDeleteLink\")) . \"\\\" href=\\\"\" . ew_HtmlEncode($this->DeleteUrl) . \"\\\">\" . $Language->Phrase(\"ViewPageDeleteLink\") . \"</a>\";\n\t\t$item->Visible = ($this->DeleteUrl <> \"\" && $Security->IsLoggedIn());\n\n\t\t// Set up action default\n\t\t$option = &$options[\"action\"];\n\t\t$option->DropDownButtonPhrase = $Language->Phrase(\"ButtonActions\");\n\t\t$option->UseImageAndText = TRUE;\n\t\t$option->UseDropDownButton = TRUE;\n\t\t$option->UseButtonGroup = TRUE;\n\t\t$item = &$option->Add($option->GroupOptionName);\n\t\t$item->Body = \"\";\n\t\t$item->Visible = FALSE;\n\t}", "function SetupOtherOptions() {\n\t\tglobal $Language, $Security;\n\t\t$options = &$this->OtherOptions;\n\t\t$option = $options[\"addedit\"];\n\n\t\t// Add\n\t\t$item = &$option->Add(\"add\");\n\t\t$addcaption = ew_HtmlTitle($Language->Phrase(\"AddLink\"));\n\t\t$item->Body = \"<a class=\\\"btn btn-success btn-xs\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->AddUrl) . \"\\\">\" . $Language->Phrase(\"AddLink\") . \" $addcaption</a>\";\n\t\t$item->Visible = ($this->AddUrl <> \"\" && $Security->CanAdd());\n\t\t$option = $options[\"action\"];\n\n\t\t// Set up options default\n\t\tforeach ($options as &$option) {\n\t\t\t$option->UseImageAndText = TRUE;\n\t\t\t$option->UseDropDownButton = FALSE;\n\t\t\t$option->UseButtonGroup = TRUE;\n\t\t\t$option->ButtonClass = \"btn-xs\"; // Class for button group\n\t\t\t$item = &$option->Add($option->GroupOptionName);\n\t\t\t$item->Body = \"\";\n\t\t\t$item->Visible = FALSE;\n\t\t}\n\t\t$options[\"addedit\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonAddEdit\");\n\t\t$options[\"detail\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonDetails\");\n\t\t$options[\"action\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonActions\");\n\n\t\t// Filter button\n\t\t$item = &$this->FilterOptions->Add(\"savecurrentfilter\");\n\t\t$item->Body = \"<a class=\\\"ewSaveFilter\\\" data-form=\\\"fvw_bridging_sep_by_no_kartulistsrch\\\" href=\\\"#\\\">\" . $Language->Phrase(\"SaveCurrentFilter\") . \"</a>\";\n\t\t$item->Visible = TRUE;\n\t\t$item = &$this->FilterOptions->Add(\"deletefilter\");\n\t\t$item->Body = \"<a class=\\\"ewDeleteFilter\\\" data-form=\\\"fvw_bridging_sep_by_no_kartulistsrch\\\" href=\\\"#\\\">\" . $Language->Phrase(\"DeleteFilter\") . \"</a>\";\n\t\t$item->Visible = TRUE;\n\t\t$this->FilterOptions->UseDropDownButton = TRUE;\n\t\t$this->FilterOptions->UseButtonGroup = !$this->FilterOptions->UseDropDownButton;\n\t\t$this->FilterOptions->DropDownButtonPhrase = $Language->Phrase(\"Filters\");\n\n\t\t// Add group option item\n\t\t$item = &$this->FilterOptions->Add($this->FilterOptions->GroupOptionName);\n\t\t$item->Body = \"\";\n\t\t$item->Visible = FALSE;\n\t}", "function SetupOtherOptions() {\n\t\tglobal $Language, $Security;\n\t\t$options = &$this->OtherOptions;\n\t\t$option = $options[\"addedit\"];\n\n\t\t// Add\n\t\t$item = &$option->Add(\"add\");\n\t\t$addcaption = ew_HtmlTitle($Language->Phrase(\"AddLink\"));\n\t\t$item->Body = \"<a class=\\\"btn btn-success btn-xs\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->AddUrl) . \"\\\">\" . $Language->Phrase(\"AddLink\") . \" $addcaption</a>\";\n\t\t$item->Visible = ($this->AddUrl <> \"\" && $Security->CanAdd());\n\t\t$option = $options[\"action\"];\n\n\t\t// Set up options default\n\t\tforeach ($options as &$option) {\n\t\t\t$option->UseImageAndText = TRUE;\n\t\t\t$option->UseDropDownButton = FALSE;\n\t\t\t$option->UseButtonGroup = TRUE;\n\t\t\t$option->ButtonClass = \"btn-xs\"; // Class for button group\n\t\t\t$item = &$option->Add($option->GroupOptionName);\n\t\t\t$item->Body = \"\";\n\t\t\t$item->Visible = FALSE;\n\t\t}\n\t\t$options[\"addedit\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonAddEdit\");\n\t\t$options[\"detail\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonDetails\");\n\t\t$options[\"action\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonActions\");\n\n\t\t// Filter button\n\t\t$item = &$this->FilterOptions->Add(\"savecurrentfilter\");\n\t\t$item->Body = \"<a class=\\\"ewSaveFilter\\\" data-form=\\\"fm_pasienlistsrch\\\" href=\\\"#\\\">\" . $Language->Phrase(\"SaveCurrentFilter\") . \"</a>\";\n\t\t$item->Visible = TRUE;\n\t\t$item = &$this->FilterOptions->Add(\"deletefilter\");\n\t\t$item->Body = \"<a class=\\\"ewDeleteFilter\\\" data-form=\\\"fm_pasienlistsrch\\\" href=\\\"#\\\">\" . $Language->Phrase(\"DeleteFilter\") . \"</a>\";\n\t\t$item->Visible = TRUE;\n\t\t$this->FilterOptions->UseDropDownButton = TRUE;\n\t\t$this->FilterOptions->UseButtonGroup = !$this->FilterOptions->UseDropDownButton;\n\t\t$this->FilterOptions->DropDownButtonPhrase = $Language->Phrase(\"Filters\");\n\n\t\t// Add group option item\n\t\t$item = &$this->FilterOptions->Add($this->FilterOptions->GroupOptionName);\n\t\t$item->Body = \"\";\n\t\t$item->Visible = FALSE;\n\t}", "function SetupOtherOptions() {\n\t\tglobal $Language, $Security;\n\t\t$options = &$this->OtherOptions;\n\t\t$option = $options[\"addedit\"];\n\n\t\t// Add\n\t\t$item = &$option->Add(\"add\");\n\t\t$addcaption = ew_HtmlTitle($Language->Phrase(\"AddLink\"));\n\t\t$item->Body = \"<a class=\\\"ewAddEdit ewAdd\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"\" . ew_HtmlEncode($this->AddUrl) . \"\\\">\" . $Language->Phrase(\"AddLink\") . \"</a>\";\n\t\t$item->Visible = ($this->AddUrl <> \"\" && $Security->CanAdd());\n\t\t$option = $options[\"action\"];\n\n\t\t// Set up options default\n\t\tforeach ($options as &$option) {\n\t\t\t$option->UseImageAndText = TRUE;\n\t\t\t$option->UseDropDownButton = FALSE;\n\t\t\t$option->UseButtonGroup = TRUE;\n\t\t\t$option->ButtonClass = \"btn-sm\"; // Class for button group\n\t\t\t$item = &$option->Add($option->GroupOptionName);\n\t\t\t$item->Body = \"\";\n\t\t\t$item->Visible = FALSE;\n\t\t}\n\t\t$options[\"addedit\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonAddEdit\");\n\t\t$options[\"detail\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonDetails\");\n\t\t$options[\"action\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonActions\");\n\n\t\t// Filter button\n\t\t$item = &$this->FilterOptions->Add(\"savecurrentfilter\");\n\t\t$item->Body = \"<a class=\\\"ewSaveFilter\\\" data-form=\\\"fotroslistsrch\\\" href=\\\"#\\\">\" . $Language->Phrase(\"SaveCurrentFilter\") . \"</a>\";\n\t\t$item->Visible = TRUE;\n\t\t$item = &$this->FilterOptions->Add(\"deletefilter\");\n\t\t$item->Body = \"<a class=\\\"ewDeleteFilter\\\" data-form=\\\"fotroslistsrch\\\" href=\\\"#\\\">\" . $Language->Phrase(\"DeleteFilter\") . \"</a>\";\n\t\t$item->Visible = TRUE;\n\t\t$this->FilterOptions->UseDropDownButton = TRUE;\n\t\t$this->FilterOptions->UseButtonGroup = !$this->FilterOptions->UseDropDownButton;\n\t\t$this->FilterOptions->DropDownButtonPhrase = $Language->Phrase(\"Filters\");\n\n\t\t// Add group option item\n\t\t$item = &$this->FilterOptions->Add($this->FilterOptions->GroupOptionName);\n\t\t$item->Body = \"\";\n\t\t$item->Visible = FALSE;\n\t}", "function HtmlTabPlugin_admin_actions()\n{\t \n\tadd_options_page('HtmlTabPlugin','HtmlTabPlugin-Text','manage_options',_FILE_,'HtmlTabPlugin_admin');//Add to Setting as sub item\n\t//add_options_page('HtmlTabPlugin','HtmlTabPlugin-Text','manage_options',_FILE_,'HtmlTabPlugin_admin');\n\t//add_object_page(\"1\",\"2\",\"manage_options\",_FILE_,\"menuFunc\");//Show bottom comment as new Item\n\t//add_utility_page(\"1\",\"2\",\"manage_options\",_FILE_,\"menuFunc\");//Show on bottom as new Item\n\t//add_menu_page(\"1\",\"2\",\"manage_options\",_FILE_,\"menuFunc\");//Show on bottom as new Item\n}", "function SetupOtherOptions() {\n\t\tglobal $Language, $Security;\n\t\t$options = &$this->OtherOptions;\n\t\t$option = $options[\"action\"];\n\n\t\t// Set up options default\n\t\tforeach ($options as &$option) {\n\t\t\t$option->UseImageAndText = TRUE;\n\t\t\t$option->UseDropDownButton = FALSE;\n\t\t\t$option->UseButtonGroup = TRUE;\n\t\t\t$option->ButtonClass = \"btn-sm\"; // Class for button group\n\t\t\t$item = &$option->Add($option->GroupOptionName);\n\t\t\t$item->Body = \"\";\n\t\t\t$item->Visible = FALSE;\n\t\t}\n\t\t$options[\"addedit\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonAddEdit\");\n\t\t$options[\"detail\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonDetails\");\n\t\t$options[\"action\"]->DropDownButtonPhrase = $Language->Phrase(\"ButtonActions\");\n\t}", "function intractive_map_actions(){\n\t//add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function);\n\tadd_options_page( 'Intractive Map Options','Intactive Map Options','manage_options',_FILE_,'intractive_map_admin');\n\t\n}", "public function options_page() {\n\t\tpremise_field_section( array(\n\t\t\tarray(\n\t\t\t\t'type' => 'text',\n\t\t\t\t'name' => 'pwps_theme_options',\n\t\t\t),\n\n\t\t\tarray(\n\t\t\t\t'type' => 'submit',\n\t\t\t)\n\t\t) );\n\t}", "function ssb_settings()\n{\n\tadd_options_page( \"FirstImpression\", \"FirstImpression\", 'administrator', 'firstimpression', 'ssb_admin_function');\n\t//this adds the page: parameters are: \"page title\", \"link title\", \"role\", \"slug\",\"function that shows the result\"\n}", "function CallHtmlShowOptionsPage() {\r\r\n\t\tif(GoogleSitemapGeneratorLoader::LoadPlugin()) {\r\r\n\t\t\t$gs = &GoogleSitemapGenerator::GetInstance();\r\r\n\t\t\t$gs->HtmlShowOptionsPage();\r\r\n\t\t}\r\r\n\t}", "function add_settings_actions() {\r\n\t\t// Add the options page\r\n\t\tadd_submenu_page( 'options-general.php', __( 'Gift Certificate', DPP_GC_DOMAIN ), __( 'Gift Certificate', DPP_GC_DOMAIN ), 'manage_options', DPP_GC_PREFIX . '-settings', array( &$this, 'settings_page' ) );\r\n\t}", "public function add_option_page() {\n add_options_page(__(FSSB_NAME,FSSB_DOMAIN), __('Floating Social Buttons',FSSB_DOMAIN), 'manage_options', FSSB_UNIQUE_ID , array($this,'render'));\n }", "function wp_ozh_yourls_plugin_actions($links) {\r\n\t$links[] = \"<a href='options-general.php?page=ozh_yourls'><b>Settings</b></a>\";\r\n\treturn $links;\r\n}", "function options() {\n\t\t\t?>\n\t\t\t<h2><?php _e('Import Options', 'echo-importer'); ?></h2>\n\t\t\t<p><?php printf( _n( 'It looks like there&#8217;s %s comment in the file.' , 'It looks like there are %s comments in the file.', $this->found_comment_count, 'echo-importer' ), $this->found_comment_count ); ?></p>\n\t\t\t<p><?php _e('Click Next to import all of them.', 'echo-importer'); ?></p>\n\t\n\t\t\t<form action=\"?import=echo&amp;step=2&amp;id=<?php echo $this->id; ?>\" method=\"post\">\n\t\t\t<?php wp_nonce_field('import-echo'); ?>\n\t\t\t<p class=\"submit\">\n\t\t\t<input type=\"submit\" class=\"button\" value=\"<?php echo esc_attr__('Next', 'echo-importer'); ?>\" /><br />\n\t\t\t</p>\n\t\t\t</form>\n\t\t\t<?php\n\t\t}", "function adext_core_page_options() {\r\n \r\n if(adverts_request( \"adaction\" ) == \"gallery\" ) {\r\n _adext_core_page_options_gallery();\r\n } else {\r\n _adext_core_page_options_main();\r\n }\r\n}", "public function dpf_on_action_trigger()\t{\r\n\r\n\t\t\t/**\r\n\t\t\t * Hook All Option Created Here\r\n\t\t\t * \r\n\t\t\t */\r\n\t\t\tdo_action( 'dpf_options' );\r\n\r\n\t\t\t/**\r\n\t\t\t * Execute all action immediately after options are created\r\n\t\t\t * \r\n\t\t\t */\r\n\t\t\tdo_action( 'dpf_done' );\r\n\r\n\t\t}", "public function option_page_callback() {\n\t\tif ( ! current_user_can( 'manage_options' ) ) {\n\t\t\twp_die( __( 'You do not have sufficient permissions to access this page' ) );\n\t\t}\n\t\t?>\n\t\t<div class=\"wrap\">\n\t\t\t<form action='options.php' method='post'>\n\t\t\t\t<?php\n\t\t\t\tsettings_fields( 'endpoints_for_sharpspring_section' );\n\t\t\t\t?>\n\t\t\t\t<h1>Endpoints for Sharpspring</h1>\n\t\t\t\t<p>Please add the required sharpspring info</p>\n\t\t\t\t<?php\n\t\t\t\tdo_settings_sections( 'endpoints-for-sharpspring' );\n\t\t\t\tsubmit_button();\n\t\t\t\t?>\n\t\t\t</form>\n\t\t</div>\n\t\t<?php\n\t}", "function rad_options_page(){\n\t//(title, menu label, capability, slug, function for page contents)\n\tadd_options_page('Company Info', 'Company Info', 'manage_options', 'rad-options-page', 'rad_options_build_form');\t\n}", "function _rex721_add_tab_option($params) {\n echo '<a href=\"#\" class=\"rex488_extra_settings_tab\" rel=\"social\" onclick=\"Rexblog.Article.ToggleExtraSettings(this, event);\">Social Links</a>&nbsp;|&nbsp;';\n}", "function saucyss_add_options_link(){\n\tadd_options_page('Saucy Social Shares Options', 'Saucy Social Shares', 'manage_options', 'saucyss-options', 'saucyss_options_page');\n}", "function GetExperienceOptionAddAction()\n {\n return \"ExperienceOptionAdd\";\n }", "protected function setupOtherOptions()\n\t{\n\t\tglobal $Language, $Security;\n\t\t$option = $this->OtherOptions[\"addedit\"];\n\t\t$option->UseDropDownButton = FALSE;\n\t\t$option->DropDownButtonPhrase = $Language->phrase(\"ButtonAddEdit\");\n\t\t$option->UseButtonGroup = TRUE;\n\n\t\t//$option->ButtonClass = \"\"; // Class for button group\n\t\t$item = &$option->add($option->GroupOptionName);\n\t\t$item->Body = \"\";\n\t\t$item->Visible = FALSE;\n\n\t\t// Add\n\t\tif ($this->CurrentMode == \"view\") { // Check view mode\n\t\t\t$item = &$option->add(\"add\");\n\t\t\t$addcaption = HtmlTitle($Language->phrase(\"AddLink\"));\n\t\t\t$this->AddUrl = $this->getAddUrl();\n\t\t\tif (IsMobile())\n\t\t\t\t$item->Body = \"<a class=\\\"ew-add-edit ew-add\\\" title=\\\"\" . $addcaption . \"\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"\" . HtmlEncode($this->AddUrl) . \"\\\">\" . $Language->phrase(\"AddLink\") . \"</a>\";\n\t\t\telse\n\t\t\t\t$item->Body = \"<a class=\\\"ew-add-edit ew-add\\\" title=\\\"\" . $addcaption . \"\\\" data-table=\\\"ipc_tracking\\\" data-caption=\\\"\" . $addcaption . \"\\\" href=\\\"#\\\" onclick=\\\"return ew.modalDialogShow({lnk:this,btn:'AddBtn',url:'\" . HtmlEncode($this->AddUrl) . \"'});\\\">\" . $Language->phrase(\"AddLink\") . \"</a>\";\n\t\t\t$item->Visible = $this->AddUrl != \"\" && $Security->canAdd();\n\t\t}\n\t}", "function wp_keyboad_actions() {\r\n add_options_page(\"Keyboard actions\", \"Keyboard actions\", \"edit_pages\", \"wp_keyboad_actions\", \"wp_keyboad_admin\");\r\n}", "function mailchimpSD_plugin_action_links($links) {\n $settings_page = add_query_arg(array('page' => 'mailchimpSF_options'), admin_url('options-general.php'));\n $settings_link = '<a href=\"'.esc_url($settings_page).'\">'.__('Settings', 'mailchimp_i18n' ).'</a>';\n array_unshift($links, $settings_link);\n return $links;\n}", "function cactions() {\n?>\n\t<aside id=\"p-cactions\" class=\"portlet widget\" role=\"navigation\">\n\t\t<h1 class=\"widget-title\"><?php $this->msg( 'views' ) ?></h1>\n\t\t\t<ul><?php\n\t\t\t\tforeach ( $this->data['content_actions'] as $key => $tab ) {\n\t\t\t\t\techo '\n\t\t\t\t' . $this->makeListItem( $key, $tab );\n\t\t\t\t} ?>\n\t\t\t</ul>\n\t</aside>\n<?php\n\t}", "function cp_register_options_page()\n{\n\n $page = add_menu_page('Convert Plus Add-ons', __('Convert Plus Add-ons', 'smile'), 'access_cp', 'bsf-extensions-14058953', '', 'div');\n}" ]
[ "0.6935223", "0.66111386", "0.65432024", "0.650195", "0.64827865", "0.6380031", "0.63786805", "0.63352156", "0.62490207", "0.62370586", "0.61580086", "0.60696584", "0.60658103", "0.6052539", "0.6049195", "0.603259", "0.6030204", "0.6026584", "0.6002957", "0.59913546", "0.59763306", "0.5943952", "0.5911673", "0.58766127", "0.58595246", "0.5832867", "0.58133966", "0.5792666", "0.57811886", "0.5760834" ]
0.7245441
0
relationExists returns whether the relation named $key exists, is loaded and is not null
public function relationExists($key) { return parent::relationLoaded($key) && isset($this->$key); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function relationLoaded(string $key): bool\n {\n return array_key_exists($key, $this->relations);\n }", "public function hasRelation($key): bool;", "public function hasRelationValue($key): bool;", "protected function hasCachedRelationship( string $key ) : bool {\n\t\treturn array_key_exists( $key, $this->cachedRelations );\n\t}", "public function hasRelationship($key)\n {\n return null !== $this->getRelationship($key);\n }", "public function hasRelation($relationName);", "public function has($relation)\n {\n return array_key_exists($relation, $this->links);\n }", "public function isRelation($key): bool\n {\n if ($this->hasAttributeMutator($key)) {\n return false;\n }\n\n $key = camel_case($key);\n\n return method_exists($this, $key) ||\n (static::$relationResolvers[get_class($this)][$key] ?? null);\n }", "public function has($relation);", "public function isRelationAttribute($key);", "public function __isset($key)\n {\n return isset($this->attributes[$key]) or isset($this->relations[$key]);\n }", "public function has($key)\n\t{\n\t\treturn isset($this->models[$key]);\n\t}", "public function hasRelation($name)\n\t{\n\t\treturn isset($this->relations[$name]);\n\t}", "private function isManyToOneRelationConfigured($key) {\n\t\t$relationConfiguration = $this->getRelationConfigurationFromTca($key);\n\t\t$cardinality = (isset($relationConfiguration['maxitems']))\n\t\t\t? intval($relationConfiguration['maxitems']) : 1;\n\n\t\treturn ($cardinality == 1);\n\t}", "protected function relationLoaded()\n {\n return false;\n }", "public function hasRelationResolver(): bool\n {\n return isset($this->relationResolver);\n }", "public function hasRelations(): bool\n {\n return count($this->relations) > 0;\n }", "public function has($key)\n {\n return array_key_exists($key, $this->dependencies);\n }", "public function hasRelation(string $name): bool\n {\n return isset($this->relations[$name]);\n }", "public function existsHasOne(string $modelName, string $modelRelation): bool\n {\n }", "public function existsHasMany(string $modelName, string $modelRelation): bool\n {\n }", "static function exists($key) {\n\t\treturn isset(self::$table[$key]);\n\t}", "public function exist($key)\n {\n return isset($this->_chain[$key]);\n }", "public function existsHasMany($modelName, $modelRelation){ }", "public function exists(string $key): bool {\n\n $stmt = $this->connection->query(\"SELECT `key` FROM {$this->table} WHERE `key`='{$key}' LIMIT 1;\");\n $res = $stmt->fetch(\\PDO::FETCH_ASSOC);\n\n $stmt->closeCursor();\n\n return isset($res[\"key\"]);\n }", "public function hasRelations();", "private function isRelationshipKey($fixture_name, $key)\n {\n $many_to_one = $this->schema->getRelationships($fixture_name, 'many-to-one');\n\n foreach ($many_to_one as $relationship) {\n\n $foreign_table = $relationship['related_table'];\n\n if ($key === $relationship['column']) {\n return TRUE; //return $fixture_name !== $foreign_table;\n }\n\n }\n\n return FALSE;\n }", "public function existsHasOne($modelName, $modelRelation){ }", "private function isOneToManyRelationConfigured($key) {\n\t\t$relationConfiguration = $this->getRelationConfigurationFromTca($key);\n\n\t\treturn isset($relationConfiguration['foreign_field'])\n\t\t\t&& isset($relationConfiguration['foreign_table']);\n\t}", "public function exists( $key )\n {\n \n if( $this->level1 )\n {\n \n $cached = $this->level1->exists($key);\n \n if( !$cached && $this->level2 )\n {\n return $this->level2->exists($key);\n }\n \n return $cached;\n \n }\n \n }" ]
[ "0.81991535", "0.7833496", "0.71447176", "0.7073174", "0.685554", "0.68147147", "0.6777602", "0.6764124", "0.66972846", "0.653522", "0.6396806", "0.6383393", "0.63478655", "0.63161975", "0.62811476", "0.6251786", "0.62023485", "0.61673015", "0.6165967", "0.61559004", "0.61533016", "0.6148897", "0.6115048", "0.60124034", "0.59826034", "0.5980437", "0.5967752", "0.5965395", "0.59475535", "0.5908694" ]
0.8697919
1
end start_class() Zamknij klase
function end_class() { $this->end_class="\n} // end class $this->php_classname\n"; if (! empty($this->php_objectname)) { $this->end_class.="\$$this->php_objectname = new $this->php_classname;\n"; } return(0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function start_class($classname,$ext=\"\",$objectname=\"\") {\n $this->php_classname=$classname;\n $this->php_objectname=$objectname;\n if (empty($ext)) {\n $this->start_class=\"class $classname {\\n\";\n } else {\n $this->start_class=\"class $classname extends $ext{\\n\";\n }\n \n return(0);\n }", "private function __() {\n }", "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "private function __construct(){}", "public function __construct() {\r\n exit('No se permite instanciar esta clase.');\r\n }", "public function bezoek() {\n\t}", "private function __construct()\n\t{}", "public function endClass()\n {\n $source = '';\n $source .= sprintf(\"})%s%s\", self::LBR_SM, self::LBR_SM);\n\n $this->source.=$source;\n }", "private function __construct() \n {}", "function __construct() {\r\n \r\n }", "function __construct() {\r\n \r\n }", "final private function __construct()\n {\n \n }", "private function __construct() {\r\n\t\t\t\r\n\t\t}", "private function __construct() {\r\n\t\t\t\r\n\t\t}", "function __construct() {\n\t\t\n\t}", "private function __construct () {}", "public function __construct()\r\r\n\t{}", "public function __construct( )\n\t {\n \n\t \n\t }", "private function __construct() {\n\t\t\n\t}", "function __construct()\n\t{\n\n\n\t}", "public function Pesion()\n {\n }", "function __construct()\n\t{\n\t\t\n\t\t\n\t}", "private function __construct()\n\t \t{\n\t \t}", "final public function __construct() {\n\n\t}", "private function __construct() \n\t{\n\t}", "public function __construct()\n\t{\n\t\t//void\n\t}" ]
[ "0.6728521", "0.6372469", "0.63694084", "0.63694084", "0.63694084", "0.63694084", "0.63694084", "0.63694084", "0.6351109", "0.6333006", "0.63225603", "0.6321636", "0.628622", "0.6222659", "0.6222659", "0.620718", "0.61979526", "0.61979526", "0.6179615", "0.6177803", "0.6170633", "0.6152732", "0.61510795", "0.6147911", "0.61439496", "0.61427426", "0.61375356", "0.61362606", "0.61328036", "0.6132518" ]
0.65041107
1
end array() Generuj plik PHP
function gen_php_file() { $php=""; $php.=$this->php_head."\n\n"; if (! empty($this->start_class)) $php.=$this->start_class; while (list($name,$value) = each ($this->vars)) { if (is_array($value)) { // generuj tablice $php.="\tvar \$$name=".$this->gen_array($value).";\n"; } else { //$value=addslashes($value); //$value=ereg_replace("\'","'",$value); $value=ereg_replace('"','\"',$value); $value=preg_replace('/\$/','\\\$',$value); $php.="\tvar \$$name=\"$value\";\n"; } } if (! empty($this->start_class)) { $this->end_class(); $php.=$this->end_class; } $php.=$this->php_foot; return $php; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function exportArray ();", "private function _generate(array $array){\n\t\t$result = null;\n\t\tforeach ($array as $sectionName => $sectionData) {\n\t\t\t$result .= \"[$sectionName]\";\n\t\t\t$result .= \"\\n\\t\";\n\t\t\t// TODO a co jezeli $sectionData nie jest array ?!\n\t\t\t$result .= $this->_generateHelper_1((array) $sectionData);\n\t\t\t$result .= \"\\n\";\n\t\t}\n\t\treturn $result;\n\t}", "protected function generateFiles()\n {\n $mode = $this->option('extended') ? 'extended' : 'default';\n\n $pluginFiles = $this->pluginFiles[$mode];\n\n foreach ($pluginFiles as $key => $file) {\n $file = $this->formatContent($file);\n\n $this->files->put($this->getDestinationFile($file), $this->getStubContent($key, $mode));\n }\n\n // Generate the Language files\n $slug = $this->data['slug'];\n\n $pluginPath = $this->getPluginPath($slug);\n\n $content ='<?php\n\nreturn array (\n);';\n\n $languageFolders = $this->getLanguagePaths($slug);\n\n foreach ($languageFolders as $folder) {\n $path = $pluginPath .$folder .DS .'messages.php';\n\n $this->files->put($path, $content);\n }\n }", "public function getFileArray();", "public function __toString() {\n $output = array();\n foreach($this->toArray() as $key => $file) {\n $output[] = $file . '<br />'; \n } \n return implode(\"\\n\", $output); \n }", "public function genTxt($name = 'US',$suffix =''){\n\n $this->autoRender = false;\n\n $dataArray = $this->request->data;\n\n /**\n * Longitud del arreglo\n * @var Int\n */\n $lenght = count($dataArray);\n\n /**\n * Ruta fisica del servidor\n * @var String\n */\n $dir = $this->getPhysicalResourcesPath();\n\n /**\n * Ruta completa donde se guardaran los rips temporalmente\n * @var String\n */\n $filePath = $dir.'rips/'.$name.$suffix.'.TXT';\n \n /**\n * manejo de archivo\n */\n $handle = fopen($filePath, 'w') or die('Cannot open file: '.$filePath);\n\n\n /**\n * Recorrido de datos\n */\n foreach ($dataArray as $row) {\n \n unset($row['id']); \n unset($row['fecha']);\n unset($row['entidad']);\n unset($row['state']); \n unset($row['orderConsectuiva']); \n\n\n /**\n * Linea a escribir\n * @var string\n */\n $line = '';\n\n /**\n * Recorrido de cara fila\n */\n foreach ($row as $data) {\n \n $line .= $data.','; \n\n }\n\n /**\n * eliminacion del ultimo caracter\n * @var String\n */\n $line = substr ($line, 0, -1);\n \n /**\n * Linea mas salto\n * @var String\n */\n $line = $line.PHP_EOL;\n /**\n * Escritura en en \n */\n fwrite($handle, $line);\n\n }\n \n /**\n * Cierre del archivo\n */\n fclose($handle); \n\n\n /**\n * Descarga del archivo generado\n */\n $this->response->file($filePath, array('download' => true, 'name' => $name.$suffix.'.TXT'));\n\n }", "function createFiles()\n {\n global $objDatabase, $_ARRAYLANG;\n\n $arrModules = array();\n $arrLanguages = array();\n $arrModulesPath = array();\n $arrModuleVariables = array();\n $arrErrorFiles = array();\n $objFile = new File();\n\n $strHeader = \"/**\\n* Contrexx CMS\\n* generated date \".date('r',time()).\"\\n**/\\n\\n\";\n\n // generate the arrays $arrModulesPath and $arrModules\n $query = \"SELECT id, name, is_core FROM \".DBPREFIX.\"modules\";\n $objResult = $objDatabase->Execute($query);\n if ($objResult !== false) {\n while (!$objResult->EOF) {\n if (strlen($objResult->fields['name'])>0) {\n switch($objResult->fields['name']) {\n case 'core':\n $arrModulesPath[$objResult->fields['name']]['sys'] = ASCMS_DOCUMENT_ROOT;\n $arrModulesPath[$objResult->fields['name']]['web'] = ASCMS_PATH_OFFSET;\n break;\n case 'Media1':\n $arrModulesPath['Media']['sys'] = ASCMS_CORE_MODULE_PATH.'/Media';\n $arrModulesPath['Media']['web'] = ASCMS_CORE_MODULE_WEB_PATH.'/Media';\n $objResult->fields['name'] = 'Media';\n break;\n case 'Media2':\n case 'Media3':\n $objResult->fields['name'] = \"\";\n break;\n default:\n $arrModulesPath[$objResult->fields['name']]['sys'] = ($objResult->fields['is_core'] == 1 ? ASCMS_CORE_MODULE_PATH : ASCMS_MODULE_PATH).'/'.$objResult->fields['name'];\n $arrModulesPath[$objResult->fields['name']]['web'] = ($objResult->fields['is_core'] == 1 ? ASCMS_CORE_MODULE_WEB_PATH : ASCMS_MODULE_WEB_PATH).'/'.$objResult->fields['name'];\n }\n if (!empty($objResult->fields['name'])) {\n $arrModulesPath[$objResult->fields['name']]['sys'] .= '/lang/';\n $arrModulesPath[$objResult->fields['name']]['web'] .= '/lang/';\n }\n }\n $arrModules[$objResult->fields['id']] = array(\n 'id' => $objResult->fields['id'],\n 'name' => $objResult->fields['name']\n );\n $objResult->MoveNext();\n }\n }\n\n // get language array\n $query = \"SELECT id, lang FROM \".DBPREFIX.\"languages\";\n $objResult = $objDatabase->Execute($query);\n if ($objResult !== false) {\n while (!$objResult->EOF) {\n $arrLanguages[$objResult->fields['id']] = array(\n 'id' => $objResult->fields['id'],\n 'lang' => $objResult->fields['lang']\n );\n $objResult->MoveNext();\n }\n }\n\n // get language variables\n $query = \"SELECT vn.name, vn.module_id, vn.backend, vn.frontend, vc.content, vc.lang_id\n FROM \".DBPREFIX.\"language_variable_names AS vn,\n \".DBPREFIX.\"language_variable_content AS vc\n WHERE vn.id=vc.varid\";\n\n // generate array $arrModuleVariables including the variables\n $objResult = $objDatabase->Execute($query);\n if ($objResult !== false) {\n while (!$objResult->EOF) {\n if ($objResult->fields['module_id'] == 0) {\n $moduleId = 1;\n } else {\n $moduleId = $objResult->fields['module_id'];\n }\n if ($objResult->fields['backend'] == 1) {\n $arrModuleVariables[$moduleId][$objResult->fields['lang_id']]['backend'][$objResult->fields['name']] = $objResult->fields['content'];\n }\n if ($objResult->fields['frontend'] == 1) {\n $arrModuleVariables[$moduleId][$objResult->fields['lang_id']]['frontend'][$objResult->fields['name']] = $objResult->fields['content'];\n }\n $objResult->MoveNext();\n }\n }\n // generate array $arrOutput with the data to write into files\n foreach ($arrModuleVariables as $moduleId => $arrLanguageVariables) {\n foreach ($arrLanguageVariables as $langId => $arrModeVariables) {\n $filePath = $arrModulesPath[$arrModules[$moduleId]['name']]['sys'].$arrLanguages[$langId]['lang'].'/';\n $webFilePath = $arrModulesPath[$arrModules[$moduleId]['name']]['web'].$arrLanguages[$langId]['lang'].'/';\n if (!file_exists($filePath)) {\n $objFile->mkDir($arrModulesPath[$arrModules[$moduleId]['name']]['sys'], $arrModulesPath[$arrModules[$moduleId]['name']]['web'], $arrLanguages[$langId]['lang'].'/');\n }\n foreach ($arrModeVariables as $strMode => $arrVariables) {\n $fileName = $strMode.\".php\";\n $arrOutput[$filePath.$fileName]['filename'] = $fileName;\n $arrOutput[$filePath.$fileName]['path'] = $filePath;\n $arrOutput[$filePath.$fileName]['webpath'] = $webFilePath;\n foreach ($arrVariables as $strName => $strContent) {\n //$strContent = stripslashes(stripslashes($strContent));\n //$strContent = str_replace(\"\\\"\", \"\\\\\\\"\", $strContent);\n //$strContent = addslashes($strContent);\n if (isset($arrOutput[$filePath.$fileName]['content'])) {\n $arrOutput[$filePath.$fileName]['content'] .= \"$\".\"_ARRAYLANG['\".$strName.\"'] = \\\"\".$strContent.\"\\\";\\n\";\n } else {\n $arrOutput[$filePath.$fileName]['content'] = \"$\".\"_ARRAYLANG['\".$strName.\"'] = \\\"\".$strContent.\"\\\";\\n\";\n }\n }\n }\n }\n }\n unset($arrModuleVariables);\n // write variables to files\n foreach ($arrOutput as $file => $strOutput) {\n $objFile->setChmod($strOutput['path'], $strOutput['webpath'], '');\n $objFile->setChmod($strOutput['path'], $strOutput['webpath'], $strOutput['filename']);\n $fileHandle = fopen($file,\"w\");\n if ($fileHandle) {\n @fwrite($fileHandle,\"<?php\\n\".$strHeader.$strOutput['content'].\"?>\\n\");\n @fclose($fileHandle);\n } else {\n array_push($arrErrorFiles,$file);\n }\n }\n\n unset($arrOutput);\n if (count($arrErrorFiles)>0) {\n foreach ($arrErrorFiles as $file) {\n $this->strErrMessage .= \"<br />\".$_ARRAYLANG['TXT_COULD_NOT_WRITE_TO_FILE'].\" (\".$file.\")\";\n }\n } else {\n $this->strOkMessage .= \"<br />\".$_ARRAYLANG['TXT_SUCCESSFULLY_EXPORTED_TO_FILES'];\n }\n }", "public function generate();", "public function generate();", "public function generate();", "public function generate();", "public function generate();", "public function generate();", "public function generate();", "function zapisDoSuboruG()\n\t{\n\t\tglobal $STDERR;\n\t\tglobal $argumenty;\n\t\tglobal $databazaG;\n\t\tif((file_put_contents($argumenty[\"output\"], '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' . \"\\n<tables>\\n\", FILE_APPEND)) === FALSE)\n\t\t{\n\t\t\tfwrite($STDERR, \"Do suboru sa nepodarilo zapisat!\\n\");\n\t\t\tfclose($STDERR);\n\t\t\texit(3);\n\t\t}\n\t\tforeach($databazaG as $index => $tabulka)\n\t\t{\n\t\t\tforeach ($tabulka as $polozka)\n\t\t\t{\t\n\t\t\t\tif((file_put_contents($argumenty[\"output\"], $polozka . \"\\n\", FILE_APPEND)) === FALSE)\n\t\t\t\t{\n\t\t\t\t\tfwrite($STDERR, \"Do suboru sa nepodarilo zapisat!\\n\");\n\t\t\t\t\tfclose($STDERR);\n\t\t\t\t\texit(3);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif((file_put_contents($argumenty[\"output\"], \"\t</table>\\n\", FILE_APPEND)) === FALSE)\n\t\t\t{\n\t\t\t\tfwrite($STDERR, \"Do suboru sa nepodarilo zapisat!\\n\");\n\t\t\t\tfclose($STDERR);\n\t\t\t\texit(3);\n\t\t\t}\n\t\t}\n\t\tif((file_put_contents($argumenty[\"output\"], \"</tables>\\n\", FILE_APPEND)) === FALSE)\n\t\t{\n\t\t\tfwrite($STDERR, \"Do suboru sa nepodarilo zapisat!\\n\");\n\t\t\tfclose($STDERR);\n\t\t\texit(3);\n\t\t}\n\t}", "public function geenerateTXT(){\n $archivo = fopen('documents/archivo.txt','a');\n $rows = Bienes::find()->all();\n fputs($archivo,\"N° de Bien\");\n fputs($archivo,\" | \");\n fputs($archivo,\"Descripcion\");\n fputs($archivo,\"\\n\");\n foreach($rows as $row)\n {\n fputs($archivo,$row->codigo);\n fputs($archivo,\" | \");\n fputs($archivo,$row->descripcion);\n fputs($archivo,\"\\n\");\n\n }\n\n\n fclose($archivo);\n }", "abstract public function files(): array;", "function prepareArray($file)\r\n\t{\t\tif(!is_array($file))\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\r\n\t\t// Welche Zeichen am anfang der Kette werden ignoriert\r\n\t\t$ignore=array(\";\", \"#\", \"/\", \"[\");\r\n\t\t\r\n\t\t// Bereite Variablen vor\r\n\t\t$return=array();\r\n\r\n\t\tfor($i=0; $i < count($file); $i++)\r\n\t\t\t{\r\n\t\t\t\t// Ersetze Windows Zeilenumbr?che\r\n\t\t\t\t$file[$i]=str_replace(\"\\r\", \"\", $file[$i]);\r\n\t\t\t\t\r\n\t\t\t\t// Ist das erste Zeichen in der ignore liste?\r\n\t\t\t\tif(in_array(substr($file[$i], 0, 1), $ignore))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Hole alle Kommentare heraus\r\n\t\t\t\t$tempplode=explode(\"{\", $file[$i]);\r\n\t\t\t\t$comments=array();\r\n\t\t\t\t$countComments=0;\r\n\t\t\t\t\r\n\t\t\t\tfor($x=1; $x < count($tempplode); $x++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$comments[$x - 1]=substr($tempplode[$x], 0, strpos($tempplode[$x], \"}\"));\r\n\t\t\t\t\t\t$tempplode[$x]=\"#COMMENT\".$countComments.substr($tempplode[$x], strpos($tempplode[$x], \"}\"));\r\n\t\t\t\t\t\t$countComments++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t// Setze Zeile wieder zusammen\r\n\t\t\t\t$file[$i]=implode(\"{\", $tempplode);\r\n\t\t\t\t\t\r\n\t\t\t\t// Ersetze TAB und Leerzeichen\r\n\t\t\t\t$file[$i]=str_replace(\"\\t\", \"\", $file[$i]);\r\n\t\t\t\t$file[$i]=str_replace(\"\\x20\", \"\", $file[$i]);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// Trenne Zeile in array\r\n\t\t\t\t$thisLine=explode(\",\", $file[$i]);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// Hat die Zeile weniger als 10 Spalten dann ?berspringe diese\r\n\t\t\t\tif(count($thisLine) < 10)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// Erstelle Array und ?bergebe die Werte\r\n\t\t\t\t$thisLine[0]=strtolower($thisLine[0]);\r\n\t\t\t\t$return[$thisLine[0]]=array();\r\n\t\t\t\t$inKlammern=0;\r\n\t\t\t\t\r\n\t\t\t\tfor($x=1; $x < count($thisLine); $x++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Ersetze Kommentare\r\n\t\t\t\t\t\tfor($z=0; $z < count($comments); $z++)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t$thisLine[$x]=str_replace(\"#COMMENT\".$z, $comments[$z], $thisLine[$x]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$return[$thisLine[0]][$x - 1]=$thisLine[$x];\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\treturn $return;\r\n\t\t\r\n\t}", "public abstract function generate();", "public abstract function generate();", "function array_to_file($race, $template, $path){\n //nactene informace se postupne ukladaji do $event, nektere jsou zapsany jen kdyz jsou zadany\n \n $event =\n //base\n \"---\" . PHP_EOL .\n \"title: '\" . $race[\"Name\"] . \"'\" . PHP_EOL .\n \"date: '\" . date(\"Y-m-d\") . \"'\" . PHP_EOL .\n \"id: '\" . $race[\"Id\"] . \"'\" . PHP_EOL .\n \"start: '\" . $this->format_date($race[\"Date1\"]) . \"'\" . PHP_EOL .\n \"end: '\" . (isset($race[\"Date2\"]) ? $this->format_date($race[\"Date2\"]) : $this->format_date($race[\"Date1\"])) . \"'\" . PHP_EOL;\n //non-necesary info\n if(isset($race[\"Place\"])) $event .= \"place: '\" . $race[\"Place\"] . \"'\" . PHP_EOL;\n if(isset($race[\"GPS\"])) $event .= \"gps: '\" . $race[\"GPS\"] . \"'\" . PHP_EOL;\n if(isset($race[\"MeetTime\"])) $event .= \"meetTime: '\" . $race[\"MeetTime\"] . \"'\" . PHP_EOL;\n if(isset($race[\"MeetPlace\"])) $event .= \"meetPlace: '\" . $race[\"MeetPlace\"] . \"'\" . PHP_EOL;\n if(isset($race[\"Link\"])) $event .= \"link: '\" . $race[\"Link\"]. \"'\" . PHP_EOL;\n if(isset($race[\"Club\"])) $event .= \"club: '\" . $race[\"Club\"]. \"'\" . PHP_EOL;\n if(isset($race[\"EventTypeDescription\"]))$event .= \"eventTypeDescription: '\" . $race[\"EventTypeDescription\"] . \"'\" . PHP_EOL;\n if(isset($race[\"StartTime\"])) $event .= \"startTime: '\" . $race[\"StartTime\"] . \"'\" . PHP_EOL;\n if(isset($race[\"Map\"])) $event .= \"map: '\" . $race[\"Map\"] . \"'\" . PHP_EOL;\n if(isset($race[\"Terrain\"])) $event .= \"terrain: '\" . $race[\"Terrain\"] . \"'\" . PHP_EOL;\n if(isset($race[\"Transport\"])) $event .= \"transport: '\" . $race[\"Transport\"] . \"'\". PHP_EOL;\n if(isset($race[\"Accomodation\"])) $event .= \"accomodation: '\" . $race[\"Accomodation\"] . \"'\". PHP_EOL;\n if(isset($race[\"Food\"])) $event .= \"food: '\" . $race[\"Food\"]. \"'\" . PHP_EOL;\n if(isset($race[\"Leader\"])) $event .= \"leader: '\" . $race[\"Leader\"] . \"'\" . PHP_EOL;\n if(isset($race[\"Sport\"])) $event .= \"sport: '\" . $race[\"Sport\"]. \"'\" . PHP_EOL;\n if(isset($race[\"Type\"])) $event .= \"type: '\" . $race[\"Type\"]. \"'\" . PHP_EOL;\n if(isset($race[\"Cancelled\"])) $event .= \"cancelled: '\" . $race[\"Cancelled\"]. \"'\" . PHP_EOL;\n if(isset($race[\"DoWeOrganize\"])) $event .= \"doWeOrganize: '\" . $race[\"DoWeOrganize\"]. \"'\" . PHP_EOL;\n //soustredeni\n if(isset($race[\"Program\"])){\n $event .= \"trainingCamp:\". PHP_EOL;\n if(isset($race[\"Program\"])) $event .= \" program: '\" . $race[\"Program\"] . \"'\" . PHP_EOL;\n if(isset($race[\"Price\"])) $event .= \" price: '\" . $race[\"Price\"] . \"'\" . PHP_EOL;\n if(isset($race[\"ThingsToTake\"])) $event .= \" thingsToTake: '\" . $race[\"ThingsToTake\"] . \"'\" . PHP_EOL;\n if(isset($race[\"Return\"])) $event .= \" return: '\" . $race[\"Return\"] . \"'\" . PHP_EOL;\n if(isset($race[\"Signups\"])) $event .= \" signups: '\" . $race[\"Signups\"] . \"'\" . PHP_EOL;\n }\n //template\n $event .= \"template: \".$template. PHP_EOL;\n\n //entry dates\n if(isset($race[\"Entry1\"])) $event .= \"entries:\" . PHP_EOL .\n \" entry1: '\" . $race[\"Entry1\"] . \"'\". PHP_EOL;\n if(isset($race[\"Entry2\"])) $event .= \" entry2: '\" . $race[\"Entry2\"] . \"'\". PHP_EOL;\n if(isset($race[\"Entry3\"])) $event .= \" entry3: '\" . $race[\"Entry3\"] . \"'\". PHP_EOL;\n if(isset($race[\"Entry4\"])) $event .= \" entry4: '\" . $race[\"Entry4\"] . \"'\". PHP_EOL;\n if(isset($race[\"Entry5\"])) $event .= \" entry5: '\" . $race[\"Entry5\"] . \"'\". PHP_EOL;\n\n //taxonomy\n $event .= \"taxonomy:\" . PHP_EOL;\n $event .= \" skupina:\" . PHP_EOL;\n if(isset($race[\"Zabicky\"])) if($race[\"Zabicky\"] == \"1\") $event .= \" - zabicky\". PHP_EOL;\n if(isset($race[\"Pulci1\"])) if($race[\"Pulci1\"] == \"1\") $event .= \" - pulci1\" . PHP_EOL;\n if(isset($race[\"Pulci2\"])) if($race[\"Pulci2\"] == \"1\") $event .= \" - pulci2\" . PHP_EOL;\n if(isset($race[\"Zaci1\"])) if($race[\"Zaci1\"] == \"1\") $event .= \" - zaci1\" . PHP_EOL;\n if(isset($race[\"Zaci2\"])) if($race[\"Zaci2\"] == \"1\") $event .= \" - zaci2\" . PHP_EOL;\n if(isset($race[\"Dorost\"])) if($race[\"Dorost\"] == \"1\") $event .= \" - dorost\" . PHP_EOL;\n if(isset($race[\"Rankings\"])){\n $event .= \" rankings:\" . PHP_EOL;\n $rankings = (int)$race[\"Rankings\"];\n if( ($rankings-128) >= 0 ) {\n $event .= \" - verejny\" . PHP_EOL;\n $rankings -= 128;\n }\n if( ($rankings-32) >= 0 ) {\n $event .= \" - stafety\" . PHP_EOL;\n $rankings -= 32;\n }\n if( ($rankings-16) >= 0 ) {\n $event .= \" - mistrovstvi\" . PHP_EOL;\n $rankings -= 16;\n }\n if( ($rankings-8) >= 0 ) {\n $event .= \" - oblast\" . PHP_EOL;\n $rankings -= 8;\n }\n if( ($rankings-4) >= 0 ) {\n $event .= \" - B_cechy\" . PHP_EOL;\n $rankings -= 4;\n }\n if( ($rankings-2) >= 0 ) {\n $event .= \" - B_morava\" . PHP_EOL;\n $rankings -= 2;\n }\n if( ($rankings-1) >= 0 ) {\n $event .= \" - A\" . PHP_EOL;\n $rankings -= 1;\n }\n }\n if(isset($race[\"Rank21\"])) $event .= \" - rank21: \" . $race[\"Rank21\"] . PHP_EOL;\n if(isset($race[\"Note\"])) $event .= \"note: '\" . $race[\"Note\"]. \"'\" . PHP_EOL;\n $event .= \"---\" . PHP_EOL;\n \n if(isset($race[\"Content\"])){\n $race[\"Content\"] = htmlspecialchars($race[\"Content\"], ENT_NOQUOTES, 'UTF-8');\n $event .= $race[\"Content\"] . PHP_EOL;\n }\n else{ \n $event .= $this->generate_content($race);\n } \n $this->file_force_contents($path, $event);\n }", "function printFileArray($array){ ?>\n<div class=\"graph1\">\n<div class=\"headerLabel\"> Statistics for file: <?php echo $array['filename']; ?></div>\nFile Size: <?php echo $array['filename']; ?> <br>\nFile Type: <?php echo $array['filesize']; ?> <br>\nUpload Date: <?php echo $array['date'];?> <br>\n\t\t<?php printGraph(unserialize($array['array']));\n}", "abstract protected function templates(): array;", "public function generate()\n\t{\n\t\t$this->multiSRC = deserialize($this->multiSRC);\n\t\t\n\t\tif (!is_array($this->multiSRC) || empty($this->multiSRC))\n\t\t{\n\t\t\treturn '';\n\t\t}\n\n\t\treturn parent::generate();\n\t}", "private function toArrayFiles()\n\t{\n\t\n\t}", "public function export(){\n $a = array();\n foreach( $this as $file ){\n $a[] = (string) $file;\n }\n return $a;\n }", "function makeJsonTrace($array){\n $jsonFile = fopen(PATH_JSON, \"w\") or die(\"impossible de creer le fichier Json Trace\");\n //on ouvre le fichier\n //on transforme le tableau en format json\n //on ecrit dans le fichier\n fwrite($jsonFile, json_encode($array, JSON_UNESCAPED_SLASHES) );\n //on ferme le fichier\n fclose($jsonFile);\n \n}", "public function __toString()\n {\n $output = \"\";\n $output .= \"\\$Path: \" . $this->path . \"<br>\\n\";\n $output .= \"\\$Path admin: \" . $this->path_admin . \"<br>\\n\";\n $output .= \"\\$Path public: \" . $this->path_public . \"<br>\\n\";\n $output .= \"\\$folder: \" . $this->folder . \"<br>\\n\";\n $output .= \"\\$current_page: = \" . $this->current_page . \"<br>\\n\";\n $output .= \"\\$current_page_php: = \" . $this->current_page_php . \"<br>\\n\";\n $output .= \"\\$http =: \" . $this->http . \"<br>\\n\";\n\n\n $output .= \"\\$layout_context: = \" . $this->layout_context . \"<br>\\n\";\n $output .= \"\\$active_admin: = \" . $this->active_admin . \"<br>\\n\";\n $output .= \"\\$active_public: = \" . $this->active_public . \"<br>\\n\";\n $output .= \"\\$full_url: = \" . $this->full_url . \"<br>\\n\";\n $output .= \"\\$url: = \" . $this->url . \"<br>\\n\";\n $output .= \"\\$top_folder: = \" . $this->top_folder . \"<br>\\n\";\n $output .= \"\\$path_folders: = \" . $this->path_folders . \"<br>\\n\";\n $output .= \"\\$folder_immediate: = \" . $this->folder_immediate . \"<br>\\n\";\n $output .= \"\\$folder_prev: = \" . $this->folder_prev . \"<br>\\n\";\n\n $output .= \"\\$http \\$folder: = \" . $this->http . $this->folder;\n\n echo \"\\$array_full_url\";\n echo '<pre>';\n print_r($this->array_full_url);\n echo '</pre>';\n echo \"\\$array_url\";\n echo '<pre>';\n print_r($this->array_url);\n echo '</pre>';\n\n\n\n return $output;\n\n }", "public function generate () {\n\t}", "abstract public function generate();" ]
[ "0.60106754", "0.5969739", "0.5817719", "0.5776806", "0.57739294", "0.5724297", "0.5710549", "0.5709587", "0.5709587", "0.5709587", "0.5709587", "0.5709587", "0.5709587", "0.5709587", "0.57049567", "0.5649798", "0.5633823", "0.5626764", "0.55836344", "0.55836344", "0.55748785", "0.55682486", "0.5558331", "0.55208266", "0.55187756", "0.55087996", "0.5505803", "0.5505356", "0.5501898", "0.5500122" ]
0.5975991
1
/ Constructor Parameters $modelClass = Name of the model this controller uses $action = Action to be performed
function __construct($modelClass, $action) { parent::__construct($modelClass, $action); $this->_session = SessionHandler::getInstance(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function modelAction($class,$action);", "public function __construct()\n {\n $this->model = new ActionLogModel();\n }", "public function __construct ()\n {\n $this->_controller = get_class($this);\n $this->_action = $_REQUEST['action'];\n $this->_layout = 'default';\n if (! strlen($this->_action)) {\n $this->_action = 'index';\n }\n $actionName = $this->_action . 'Action';\n if (method_exists($this, $actionName)) {\n $this->_view = $this->_action;\n $this->init();\n $this->$actionName();\n } else {\n throw new Exception_Action(\"Invalid Action $actionName called\");\n }\n }", "public function __construct($controller, $action)\r\n {\r\n parent::__construct($controller, $action);\r\n // Load models\r\n $this->load_model('Document');\r\n }", "public function __construct($controller,$action) {\n\t\t\tparent::__construct($controller, $action);\n\t\t\t\n\t\t\t// Load models\n\t\t\t$this->load_model('User');\n\t\t}", "public function init() {\n\t\t$this->_action = new Default_Model_Action;\n\t}", "public function __construct($controller, $action){\n $this->_controller = $controller;\n $this->_action = $action;\n $this->request = new Input();\n // $this->view = new View();\n }", "function __construct($controller, $action)\n {\n header(\"Access-Control-Allow-Orgin: *\");\n header(\"Access-Control-Allow-Methods: *\");\n\n if (isset($_REQUEST['request_type']) && $_REQUEST['request_type'] == 'api'){\n header(\"Content-Type: application/json\");\n $this->_is_api = true;\n }\n\n $this->_method = $_SERVER['REQUEST_METHOD'];\n if ($this->_method == 'POST' && array_key_exists('HTTP_X_HTTP_METHOD', $_SERVER)) {\n if ($_SERVER['HTTP_X_HTTP_METHOD'] == 'DELETE') {\n $this->_method = 'DELETE';\n } else if ($_SERVER['HTTP_X_HTTP_METHOD'] == 'PUT') {\n $this->_method = 'PUT';\n } else {\n throw new Exception(\"Unexpected Header\");\n }\n }\n\n $this->_request = $_REQUEST;\n\n /*\n\n switch($this->method) {\n case 'DELETE':\n case 'POST':\n case 'GET':\n $this->request = $this->_cleanInputs($_GET);\n break;\n case 'PUT':\n $this->request = $this->_cleanInputs($_GET);\n $this->file = file_get_contents(\"php://input\");\n break;\n default:\n $this->_response('Invalid Method', 405);\n break;\n } */\n\n\n global $inflect;\n $this->_controller = ucfirst($controller);\n $this->_action = $action;\n\n $model = ucfirst(Inflection::singularize($controller));\n $this->doNotRenderHeader = 0;\n $this->render = 1;\n\n $this->_loadModel($model);\n $this->_template = new Template($controller, $action);\n\n #check for add models array and add all the models specified\n if ($this->_addModels){\n $this->addModels();\n }\n }", "public function __construct($action, $model, array $params)\n {\n $model = str_replace('\\\\', '.', is_object($model) ? get_class($model) : $model);\n if ($action === 'callMethod') {\n $action = $params[0];\n }\n if ($action === 'callStaticMethod') {\n $action = '&' . $params[0];\n }\n parent::__construct(__('jdd-api::exceptions.AuthorizationException', compact('action', 'model')));\n }", "public function __construct($controller,$action) {\n\t\tparent::__construct($controller, $action);\n\t\t\n\t}", "public function __construct($controller,$action) {\n\t\tparent::__construct($controller, $action);\n\t\t\n\t}", "public function __construct($action, $urlValues){\n\n\t\tparent::__construct($action, $urlValues);\n\t\t\n\t\t// create the model object\n\t\trequire (\"models/home.php\");\n\t\t$this->model = new HomeModel();\n\t\n\t}", "public function __construct(Request $request, $action) {\n parent::__construct($request, $action);\n //menu entries\n $this->_modelView['header'] = array(\n 'REFERENTIAL'=> $this->_index.'/referentiel',\n 'FUNCTION'=> $this->_index.'/fonction',\n 'ACTIVITY'=> $this->_index.'/activite',\n 'SKILL'=> $this->_index.'/competence',\n 'PROFESSIONAL' => $this->_index.'/attitude_professionnelle',\n 'DOCUMENT'=> $this->_index.'/document',\n 'PROMOTION'=> $this->_index.'/promotion',\n 'TEACHER'=> $this->_index.'/enseignant',\n 'TRAINEE'=> $this->_index.'/stagiaire',\n 'WORK_DATE'=> $this->_index.'/stage',\n 'PASSWORD'=> $this->_index.'/acces',\n );\n }", "public function __construct($action, $urlValues) {\n\t\tparent::__construct($action, $urlValues);\n\n\t\t//create the model object\n\t\trequire(PATH.'models/home.php');\n\t\t$this->model = new HomeModel($this->view);\n\t}", "public function modelActionWithParams($class,$action,$params=null);", "function __construct($controller,$action)\n {\n $this->_controller=$controller;\n $this->_action=$action;\n }", "public function __construct($className, $action)\n {\n parent::__construct($className, $action);\n \n //these are editable\n $this->view->setSiteTitle('Cart - Haarlem Festival');\n $this->view->setBgImage('orderbg.jpg');\n }", "function __construct(){\n\t\t$this->request = new Request(); \n\t\tRouter::parse($this->request->url,$this->request); \n \n\t\t$controller = $this->loadController();\n $action = $this->request->action;\n\t\tif($this->request->prefix){\n\t\t\t$action = $this->request->prefix.'_'.$action;\n\t\t}\n \n \n $par=true;\n foreach($this->request->params as $k=>$v){\n $v=filter_var($v,FILTER_VALIDATE_INT);\n if($v===false){\n $par=false;\n }\n }\n if(($this->request->action=='confirm')&&($this->request->controller=='users')){\n $par=true ; \n }\n if(($this->request->action=='index')&&($this->request->controller=='users')){\n $par=true ; \n }\n if($par===true){\n call_user_func_array(array($controller,$action),$this->request->params); \n \n }\n else{\n $this->error($controller->s['l_error']) ;\n }\n\t\t\n \n //modifier cette partie pour avoir un appel direct au model sans l'intermédiare du controlleur\n \n $this->aclick($this->request);\n \n if ($this->request->norend==false)\n {\n \n $controller->render($action); \n }\n \n \n\t\t\n\t}", "public function __construct()\r\n\t{\r\n\t\tparent::__construct();\r\n\t\t$this->loadModel('user');\r\n\t\t$this->loadModel('action');\r\n\t}", "public function __construct($action, $urlValues){\n\n\t\tparent::__construct($action, $urlValues);\n\t\t$this->Session = new Session();\n\t\t$this->loggedUserId = $this->Session->getLoggedUserId();\n\t\t\n\t\t// create the model object\n\t\trequire (\"models/Usuario.php\");\n\t\t$this->model = new UsuarioModel();\n\t\n\t}", "public function __construct()\n {\n //$this->model = $model;\n }", "public function __construct() {\n $this->model = new finalModel();\n $this->view = new finalView();\n \n $this->nav = $_GET['nav'] ? $_GET['nav'] : 'home';\n $this->action = $_POST['action'];\n }", "public function __construct()\n {\n // Prepare the action for execution, leveraging constructor injection.\n }", "function __construct($controller, $action) {\n $this->_controller = $controller;\n $this->_action = $action;\n }", "public function model($controller, $action) {\n $file = DIR_SERVER . 'catalog/model/' . $controller . '/' . ucfirst($action) . 'Model.php';\n if (is_readable($file)) {\n require_once($file);\n } else {\n Log::error(\"<b>Error:</b> Model {$action} in {$file} not found\", \"Error: Model {$action} in {$file} not found\");\n }\n }", "public function __construct() {\n \t$this->model = new Model();\n }", "public function __construct(){\n \n \n require_once('libraries/models/'.$this->modelName.'.php');\n \n //Précision: new $this->modelName() correspond à new 'nom de l'objet'().\n //Ici le nom de l'objet est définie par la variable $modelName,à la création de l'objet; cf fichier 'AnnonceController.php'\n $this->model = new $this->modelName();\n }", "public function __construct(){\n\t\t$this->model = new Model();\n\t}", "public function __construct() {\n\t\t$this->model = new Model();\n\t}", "public function __construct(){\n \n $url = isset($_GET[\"url\"])? $_GET[\"url\"]:\"index/home\";\n $url_array = $this->urlParse($url);\n \n // setting controller and model as string and array\n $this->setClassAttr($url_array);\n \n // including controller class and instantiate and calling method. passing parameters.\n \n $this->load();\n \n \n \n \n \n \n }" ]
[ "0.75872296", "0.7111936", "0.694428", "0.6931816", "0.68520653", "0.6781464", "0.67786855", "0.67706627", "0.67349416", "0.6682956", "0.6682956", "0.66572285", "0.66468817", "0.6643221", "0.6633621", "0.658633", "0.65573895", "0.6538904", "0.65193164", "0.6516046", "0.6398505", "0.6386503", "0.63820136", "0.63527745", "0.6289966", "0.6251798", "0.6239612", "0.6239368", "0.62044847", "0.6201275" ]
0.80474156
0
/ Members Action: Shows the Member Area
protected function members() { if ($this->_session->isLoggedIn() == false) { die('Not logged in'); } else { $this->_viewTemplate = new Template("MemberTools", "membersArea"); $links = $this->_model->getMemberTools($this->_session->getUserName()); $this->_viewTemplate->set('title', 'Acme Corp - Members Area'); $this->_viewTemplate->set('links', $links); $this->_viewTemplate->render(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Member $member)\n {\n \t//\n }", "public function show(Member $member)\n {\n //\n }", "public function index() { \r\n // Set meta data\r\n $metaData = array();\r\n $metaData['title'] = \"Manage members\"; \r\n $this->view->meta = $metaData;\r\n $this->view->dashboardAssets = false; \r\n\t\t$this->view->dropzoneAssets = false;\t\r\n $this->view->datatableAssets = true;\r\n $this->view->formAssets = true; \r\n // load members view page\r\n $this->view->LoadView('members', 'members');\r\n }", "public function show(MemberAvatar $membersAvatar) {\n //\n }", "public function member()\n\t{\n\t\t// Get infor from database\n\t\t$users = user::all();\n\t\t$enterprisea = enterprise_account::all();\n\t\treturn view('member', compact('users','enterprisea'));\n\t}", "public function getMemberIndex() {\n\t\t$members = Member::with('user')->whereIsMember(true)->get();\n\n return view('admin.hr.members.list', [\n 'members' => $members,\n ]);\n\t}", "public function indexAction()\n\t{\n\t\t// redirect to member list?\n\t}", "public function profileAction()\n\t{\n\t\t// Get the specified member id\n\t}", "function membership(){\n\t\tif(ShoppingCart::curr() && self::$skip_if_logged_in && Member::currentUser()){\n\t\t\tController::curr()->redirect($this->NextStepLink());\n\t\t\treturn;\n\t\t}\n\t\treturn $this->owner->customise(array(\n\t\t\t'Form' => $this->MembershipForm(),\n\t\t\t'LoginForm' => $this->LoginForm(),\n\t\t\t'GuestLink' => $this->NextStepLink()\n\t\t))->renderWith(array(\"CheckoutPage_membership\",\"CheckoutPage\",\"Page\")); //needed to make rendering work on index\n\t}", "public function member_area()\n {\n $data = [\n 'title' => 'Member',\n 'member' => $this->pelayanan->getMember(),\n 'barber' => $this->db->get_where('pegawai', ['role_id' => 3])->result_array(),\n 'jasa' => $this->db->get('jasa')->result_array()\n ];\n $this->load->view('template/header', $data);\n $this->load->view('pelayanan/member');\n $this->load->view('template/footer');\n }", "public function showMember($id){\r\n if ($id === \"index.php\") {\r\n $this->_f3->reroute('/');\r\n }\r\n\r\n $member = $this->_db->getMember($id);\r\n if ($member[0][\"premium\"] == \"0\") {\r\n $_SESSION[\"user\"] = new Member();\r\n } else {\r\n $_SESSION[\"user\"] = new PremiumMember();\r\n $_SESSION[\"user\"]->setInterests($this->_db->getInterests($id));\r\n $_SESSION[\"user\"]->setImage($member[0][\"image\"]);\r\n }\r\n\r\n $_SESSION[\"user\"]->setFname($member[0][\"fname\"]);\r\n $_SESSION[\"user\"]->setLname($member[0][\"lname\"]);\r\n $_SESSION[\"user\"]->setAge($member[0][\"age\"]);\r\n $_SESSION[\"user\"]->setGender($member[0]['gender']);\r\n $_SESSION[\"user\"]->setPhone($member[0][\"phone\"]);\r\n $_SESSION[\"user\"]->setEmail($member[0][\"email\"]);\r\n $_SESSION[\"user\"]->setState($member[0][\"state\"]);\r\n $_SESSION[\"user\"]->setSeeking($member[0][\"seeking\"]);\r\n $_SESSION[\"user\"]->setBio($member[0]['bio']);\r\n\r\n\r\n $view = new Template();\r\n echo $view->render(\"views/profile-summary.html\");\r\n }", "protected function getMembers(){\n return view('frontpages.members');\n}", "public function run() {\n\n //$spaceGuid = Yii::app()->getController()->getSpace()->guid;\n\n $this->render('spaceMembers', array('space' => Yii::app()->getController()->getSpace()));\n }", "public function index()\n\t{\n\t\t$members = \\App\\User::where('admin','=', 0)->orWhere('admin','=', 2)->orWhere('admin','=', 3)->get();\n\t\t$divisions = \\App\\Division::get();\n\t\treturn view('admin.member.index', compact('members', 'divisions'));\n\t}", "public function show(Member $profiles)\n {\n //\n }", "public function showMembers(Request $request, $ryhmaID) {\n $group = Targetgroup::findOrFail($ryhmaID);\n view()->share('currentpage', 'jasenet'); // This route is one of the sidebar menu links\n return view('member/groupmembers')->with('members', $group->members()->where('isActivated', 1)->get());\n }", "public function index()\n {\n return view('admin.members.index');\n }", "public function show(facultyMembers $facultyMember)\n {\n\n }", "public function index()\n\t{\n\t\t$coordination_members = $this->coordination_member->all();\n\n\t\treturn View::make('coordination_members.index', compact('coordination_members'));\n\t}", "public function index()\n {\n $v_data[\"all_members\"] = $this->member_model->get_members();\n\n $data = array(\"title\" => $this->site_model->display_page_title(),\n \"content\" => $this->load->view(\"member/all_members\", $v_data, true),\n\n );\n $this->load->view(\"site/layouts/layout\", $data);\n }", "public function membership()\n {\n if (ShoppingCart::curr() && self::$skip_if_logged_in && Member::currentUser()) {\n Controller::curr()->redirect($this->NextStepLink());\n return;\n }\n return $this->owner->customise(\n array(\n 'Form' => $this->MembershipForm(),\n 'LoginForm' => $this->LoginForm(),\n 'GuestLink' => $this->NextStepLink(),\n )\n )->renderWith(\n array(\"CheckoutPage_membership\", \"CheckoutPage\", \"Page\")\n ); //needed to make rendering work on index\n }", "public function memberlist(){\n $members = Membership::paginate(16);\n return view('membership.members-list')->with(compact('members'));\n }", "public function index()\n {\n $members = Member::all();\n return view('superadmin.member.index', compact('members'));\n }", "public function admin()\n {\n return view('admin.members');\n }", "public function dashboard_membership_metabox() {\r\n\t\t$this->view( 'dashboard/welcome/pro-membership-meta-box', array() );\r\n\t}", "public function index()\n {\n return view('members.index');\n }", "public function actionMember_li()\n {\n return $this->render('member_li');\n }", "public function index()\n {\n $members = Member::listingMembers();\n $title = ' | Bienvenue Sur la Plateforme Universelle de Don de Sang';\n $data = [\n 'title'=>$title,\n 'members'=>$members\n ];\n return view('member/index')->with($data);\n }", "public function index()\n {\n $members = User::where('user_id', auth()->id())->get();\n\n return view('members.index', compact('members'));\n }", "public function show($id)\n {\n $c_member = Committee_member::find($id);\n $c_member_region = DB::table('regions')->where('id', $c_member->region_id)->value('region_name');\n return view('admin.committee-members.show', compact(\n 'c_member',\n 'c_member_region',\n ));\n }" ]
[ "0.73870206", "0.735446", "0.73074657", "0.7286052", "0.70932513", "0.7069073", "0.6823701", "0.6810352", "0.680688", "0.6748265", "0.6723762", "0.6722886", "0.6720588", "0.6686818", "0.6683449", "0.66738015", "0.66669345", "0.6633655", "0.6629353", "0.6620396", "0.6610866", "0.65887004", "0.65802747", "0.6576763", "0.6540146", "0.6531114", "0.65183634", "0.6516032", "0.6511814", "0.64987296" ]
0.81151855
0
Initializes DynamoDb client. This methods should be invoked in every public methods.
private static function init () { if ( self::$client === null ) self::$client = AWS::createClient("DynamoDb"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __construct($dbClient=null,$snsClient=null)\n\t{\n\t\t$this->dbClient = Aws\\DynamoDb\\DynamoDbClient::factory(array(\n\t\t\t\t'key' => 'AKIAIABMO7HONKJPMUVQ',\n\t\t\t\t'secret' => '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',\n\t\t\t\t'region' => 'us-west-2'\n\t\t));\t\t\n\t\t\n\t\t// Create a new Amazon SnsClient\n\t\t$this->snsClient = Aws\\Sns\\SnsClient::factory(array(\n\t\t\t\t'key' => 'AKIAIABMO7HONKJPMUVQ',\n\t\t\t\t'secret' => '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',\n\t\t\t\t'region' => 'us-west-2'\n\t\t));\t\t\n\t}", "protected function initClient()\n {\n $this->client = new Client(['base_uri' => getenv('SALESFORCE_INSTANCE_URL') . 'services/data/' . getenv('SALESFORCE_API_VERSION') . '/']);\n }", "public function initialize() {\n\t\ttry {\n\t\t\t$this->client = new \\TYPO3\\CouchDB\\Client($this->settings['backendOptions']['dataSourceName'], $this->settings['backendOptions']['options']);\n\n\t\t\tif (!$this->client->databaseExists($this->settings['backendOptions']['databaseName'])) {\n\t\t\t\t$this->client->createDatabase($this->settings['backendOptions']['databaseName']);\n\t\t\t}\n\n\t\t\t$this->client->setDatabaseName($this->settings['backendOptions']['databaseName']);\n\t\t} catch (\\Exception $exception) {\n\t\t\tthrow new \\Radmiraal\\CouchDB\\Exception('Could not connect to CouchDB server');\n\t\t}\n\t}", "protected function newDynamodbClient(array $config)\n {\n $dynamoConfig = [\n 'region' => $config['region'],\n 'version' => 'latest',\n 'endpoint' => $config['endpoint'] ?? null,\n ];\n\n if (isset($config['key']) && isset($config['secret'])) {\n $dynamoConfig['credentials'] = Arr::only(\n $config, ['key', 'secret', 'token']\n );\n }\n\n return new DynamoDbClient($dynamoConfig);\n }", "public function initGatewayClient()\n {\n\n }", "protected function init()\n {\n $this->client = new Client(\n $this->getHttpClientConfig()\n );\n\n $this->continents = Continents::load();\n }", "private function initializeClient(): void {\n\t\t$dsn = $this->get_dsn();\n\n\t\t// Do not re-initialize the client when the DSN has not changed\n\t\tif ( $this->client !== null && $this->dsn === $dsn ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$this->dsn = $this->get_dsn();\n\n\t\t$clientBuilder = ClientBuilder::create( $this->get_default_options() );\n\n\t\tif ( defined( 'WP_SENTRY_CLIENTBUILDER_CALLBACK' ) && is_callable( WP_SENTRY_CLIENTBUILDER_CALLBACK ) ) {\n\t\t\tcall_user_func( WP_SENTRY_CLIENTBUILDER_CALLBACK, $clientBuilder );\n\t\t}\n\n\t\t$clientBuilder->setSdkIdentifier( WP_Sentry_Version::SDK_IDENTIFIER );\n\t\t$clientBuilder->setSdkVersion( WP_Sentry_Version::SDK_VERSION );\n\n\t\t$hub = new Hub( $this->client = $clientBuilder->getClient() );\n\n\t\t$hub->configureScope( function ( Scope $scope ) {\n\t\t\tforeach ( $this->get_default_tags() as $tag => $value ) {\n\t\t\t\t$scope->setTag( $tag, $value );\n\t\t\t}\n\t\t} );\n\n\t\tSentrySdk::setCurrentHub( $hub );\n\t}", "public function initialize() : void\n {\n // Connect the database\n $this->db = $this->di->get(\"db\");\n $this->db->connect();\n }", "protected function setUp()\n {\n $this->db = \\App\\Bdd\\BddFactory::create(\"memory\");\n $this->db->exec(file_get_contents(APP_ROOT . '/ressources/tests/databases/memory.sql'));\n \n $this->object = new Client($this->db);\n }", "public function init()\r\n {\r\n parent::init();\r\n $this->db = Instance::ensure($this->db, Connection::className());\r\n $this->cache = Yii::$app->cache;\r\n }", "public function init()\n {\n $this->httpClient = new Client([\n 'base_uri' => self::API_BASE_URL . '/' . self::API_VERSION . '/',\n ]);\n }", "public function initialize()\n {\n \tparent::initialize();\n \t$this->setConnectionService(ServiceName::DB_MISMEET);\n }", "public function init()\n {\n $this->db = Instance::ensure($this->db, Connection::className());\n }", "public function initialize() : void\n {\n // Use to initialise member variables.\n $this->db = \"active\";\n $service = $this->di->get(\"apikeys\");\n\n $this->validator = new IPValidator($service->getIpKey());\n $this->report = new WeatherReport($service->getWeatherKey());\n }", "function __construct(){\n $this->_db = (new DataBaseServices())->connect();\n }", "public function __construct()\n {\n $this->setDbAdapter(self::getDefaultDbAdapter());\n $this->init();\n }", "public function init()\n {\n parent::init();\n $this->db = Instance::ensure($this->db, Connection::className());\n }", "public function initializeTask()\n {\n $dbconf = Config::get('database.dois');\n\n $clientRepository = new ClientRepository(\n $dbconf['hostname'],\n $dbconf['database'],\n $dbconf['username'],\n $dbconf['password'],\n $dbconf['port']\n );\n\n $doiRepository = new DoiRepository(\n $dbconf['hostname'],\n $dbconf['database'],\n $dbconf['username'],\n $dbconf['password'],\n $dbconf['port']\n );\n\n $bulkRequest = BulkRequest::find($this->bulkID);\n\n $params = json_decode($bulkRequest->params, true);\n\n\n $client = $clientRepository->getByID($bulkRequest->client_id);\n\n $config = Config::get('datacite');\n\n\n // $clientUsername = $config['name_prefix'] . \".\" . $config['name_middle'] . str_pad($client->client_id, 2, '-', STR_PAD_LEFT);\n $clientUsername = $client->repository_symbol;\n $clientPassword = (isset($client->shared_secret) AND $client->shared_secret !='')\n ? $client->shared_secret : $config['password'];\n $clientTestPassword = (isset($client->test_shared_secret) AND $client->test_shared_secret !='')\n ? $client->test_shared_secret : $config['testPassword'];\n\n $dataciteClient = new MdsClient($clientUsername,$clientPassword,$clientTestPassword );\n\n if($params['mode'] == 'test'){\n $dataciteClient->setDataciteUrl($config['base_test_url']);\n }else{\n $dataciteClient->setDataciteUrl($config['base_url']);\n }\n\n $doiService = new DOIServiceProvider($clientRepository, $doiRepository, $dataciteClient);\n\n\n $doiService->setAuthenticatedClient($client);\n\n $this->doiService = $doiService;\n }", "public function __construct()\n\t{\n\t\trequire_once ISC_BASE_PATH.'/lib/class.datastore.disk.php';\n\t\t$this->handler = new ISC_DATA_STORE_DISK;\n\t\t$this->handler->Connect();\n\t}", "public function __construct()\n {\n $this->client = new Client([\n 'base_uri' => config('api-gateway.api_endpoint')\n ]);\n }", "public function initialize()\n {\n // attributes\n $this->setName('Client_Quoting');\n $this->setPhpName('ClientQuoting');\n $this->setClassname('Webmis\\\\Models\\\\ClientQuoting');\n $this->setPackage('Models');\n $this->setUseIdGenerator(true);\n // columns\n $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);\n $this->addColumn('createDatetime', 'createDatetime', 'TIMESTAMP', true, null, null);\n $this->addColumn('createPerson_id', 'createPersonId', 'INTEGER', false, null, null);\n $this->addColumn('modifyDatetime', 'modifyDatetime', 'TIMESTAMP', true, null, null);\n $this->addColumn('modifyPerson_id', 'modifyPersonId', 'INTEGER', false, null, null);\n $this->addColumn('deleted', 'deleted', 'BOOLEAN', true, 1, false);\n $this->addColumn('master_id', 'masterId', 'INTEGER', false, null, null);\n $this->addColumn('identifier', 'identifier', 'VARCHAR', false, 16, null);\n $this->addColumn('quotaTicket', 'quotaTicket', 'VARCHAR', false, 20, null);\n $this->addForeignKey('quotaType_id', 'quotaTypeId', 'INTEGER', 'QuotaType', 'id', false, null, null);\n $this->addColumn('stage', 'stage', 'INTEGER', false, 2, null);\n $this->addColumn('directionDate', 'directionDate', 'TIMESTAMP', true, null, null);\n $this->addColumn('freeInput', 'freeInput', 'VARCHAR', false, 128, null);\n $this->addColumn('org_id', 'orgId', 'INTEGER', false, null, null);\n $this->addColumn('amount', 'amount', 'INTEGER', true, 1, 0);\n $this->addColumn('MKB', 'mkb', 'VARCHAR', true, 8, null);\n $this->addColumn('status', 'status', 'INTEGER', true, 2, 0);\n $this->addColumn('request', 'request', 'INTEGER', true, 1, 0);\n $this->addColumn('statment', 'statment', 'VARCHAR', false, 255, null);\n $this->addColumn('dateRegistration', 'dateRegistration', 'TIMESTAMP', true, null, null);\n $this->addColumn('dateEnd', 'dateEnd', 'TIMESTAMP', true, null, null);\n $this->addColumn('orgStructure_id', 'orgStructureId', 'INTEGER', false, null, null);\n $this->addColumn('regionCode', 'regionCode', 'VARCHAR', false, 13, null);\n $this->addForeignKey('pacientModel_id', 'pacientModelId', 'INTEGER', 'rbPacientModel', 'id', true, null, null);\n $this->addForeignKey('treatment_id', 'treatmentId', 'INTEGER', 'rbTreatment', 'id', true, null, null);\n $this->addColumn('event_id', 'eventId', 'INTEGER', false, null, null);\n $this->addColumn('prevTalon_event_id', 'prevTalonEventId', 'INTEGER', false, null, null);\n $this->addColumn('version', 'version', 'INTEGER', true, null, null);\n // validators\n }", "public function init()\n\t{\n\t\t$this->checkToken();\n\t\t$this->client = $this->app->getResourceServer()->getClientId();\n\t\t$this->table = $this->app->table('\\\\Denizen\\\\Table\\\\PasswordTokens');\n\t}", "public function initialize()\n {\n $this->setSchema(\"QODR\");\n }", "public function init(array $connection_config, array $key_store_keys = array())\n {\n $this->keys = $key_store_keys;\n $this->client = new Client($connection_config);\n }", "public function initialize()\n {\n parent::initialize();\n $this->setConnectionService(ServiceName::DB_WMS);\n }", "public function initialize()\n {\n parent::initialize();\n $this->setConnectionService(ServiceName::DB_WMS);\n }", "public function initialize()\n {\n parent::initialize();\n $this->setConnectionService(ServiceName::DB_WMS);\n }", "public function initialize()\n {\n parent::initialize();\n $this->setConnectionService(ServiceName::DB_WMS);\n }", "public function initialize()\n {\n parent::initialize();\n $this->setConnectionService(ServiceName::DB_WMS);\n }", "public function setUp()\n {\n $this->client = static::createClient();\n }" ]
[ "0.694888", "0.6554363", "0.6515124", "0.6026881", "0.59747547", "0.5889246", "0.5883719", "0.5825881", "0.5789187", "0.5780992", "0.57513374", "0.5747005", "0.5734234", "0.57118845", "0.5687578", "0.56867427", "0.5683524", "0.56756216", "0.5668209", "0.5620965", "0.5591417", "0.55470705", "0.5545366", "0.55437475", "0.554019", "0.554019", "0.554019", "0.554019", "0.554019", "0.5527064" ]
0.8648876
0
toggle upvote of Answer
public function toggle_ans_upvote($ForumAnswerID) { //deleting old negetive vote $where=NULL; $where=[ 'ForumAID'=>$ForumAnswerID, 'UserID'=>$this->session->UserID, 'VoteType'=>-1 ]; $data=$this->db ->where($where) ->delete('tblforumaxvote',$where); //inserting new data $where=NULL; $where=[ 'ForumAID'=>$ForumAnswerID, 'UserID'=>$this->session->UserID ]; $data=$this->db ->where($where) ->get('tblforumaxvote') ->result(); if(count($data)===0) { $Insert_Data=NULL; $Insert_Data=[ 'ForumAID'=>$ForumAnswerID, 'UserID'=>$this->session->UserID, 'VoteType'=>1 ]; $this->db->insert('tblforumaxvote',$Insert_Data); } else //deleting old positive vote { $where=NULL; $where=[ 'ForumAID'=>$ForumAnswerID, 'UserID'=>$this->session->UserID ]; $data=$this->db ->where($where) ->delete('tblforumaxvote',$where); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toggle_ans_downvote($ForumAnswerID)\n\t{\n\t\t//deleting old possitive vote\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>1\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->delete('tblforumaxvote',$where);\n\t\t\n\t\t//inserting new data\n\t\t$data=NULL;\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t'UserID'=>$this->session->UserID\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->get('tblforumaxvote')\n\t\t\t->result();\n\t\tif(count($data)===0)\n\t\t{\n\t\t\t$Insert_Data=NULL;\n\t\t\t$Insert_Data=[\n\t\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t\t'VoteType'=>-1\n\t\t\t];\n\t\t\t$this->db->insert('tblforumaxvote',$Insert_Data);\n\t\t}\n\t\telse //deleting old negetive vote\n\t\t{\n\t\t\t$where=NULL;\n\t\t\t$where=[\n\t\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t\t'UserID'=>$this->session->UserID\n\t\t\t];\n\t\t\t$data=$this->db\n\t\t\t\t->where($where)\n\t\t\t\t->delete('tblforumaxvote',$where);\n\t\t}\n\t}", "function test_a_user_ca_switch_from_upvote_to_downvote(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::upvote($this->post);\n // cargamos el repositorio para poder votar por le post\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n // Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n //app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(-1, $this->post->score);\n }", "function test_a_user_ca_switch_from_downvote_to_upvote(){\n // llamamos a la funcion downVote para darle un punto negativo al post\n // Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n //app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n // Vote::upvote($this->post);\n // cargamos el repositorio para crear un voto\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(1, $this->post->score);\n }", "function upvote($user, $name, $id)\n{\n $tryVote = registerVote($user, $name, $id);\n if($tryVote){\n $oldscore = getScore($id);\n $newscore = incScore($id, $oldscore);\n return $newscore;\n }\n else return false;\n \n}", "public function rollbackUpvotes($qid)\n {\n return $this->db->query('update forum_questions set upvotes=upvotes-1 where qid='.$qid);\n }", "public function toggle_upvote($ForumQuestionID)\n\t{\n\t\t//deleting old negetive vote\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>-1\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->delete('tblforumqxvote',$where);\n\t\n\t\t//inserting new data\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->get('tblforumqxvote')\n\t\t\t->result();\n\t\tif(count($data)===0)\n\t\t{\n\t\t\t$Insert_Data=NULL;\n\t\t\t$Insert_Data=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t\t'VoteType'=>1\n\t\t\t];\n\t\t\t$this->db->insert('tblforumqxvote',$Insert_Data);\n\t\t}\n\t\telse //deleting old positive vote\n\t\t{\n\t\t\t$where=NULL;\n\t\t\t$where=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID\n\t\t\t];\n\t\t\t$data=$this->db\n\t\t\t\t->where($where)\n\t\t\t\t->delete('tblforumqxvote',$where);\n\t\t}\n\t}", "public function update_rating($answer_id, $vote){\n\t\tif($vote == \"up\"){\n\t\t\t$this->db->set(\"rating\", \"rating+1\", FALSE);\n\t\t}\n\t\telse if($vote == \"down\"){\n\t\t\t$this->db->set(\"rating\", \"rating-1\", FALSE);\n\t\t}\n\t\t$this->db->where(\"answer_id\", $answer_id);\n\t\t$this->db->update(\"answers\");\n\t}", "public function getUpvote(): bool {\n return $this->upvote;\n }", "function vote_post($uid, $pid, $votetype){\n\t\tif($this->check_user_voted($uid,$pid,$votetype)){\n\t\t\t//user voted, return\n\t\t\t$query = \"DELETE FROM votes WHERE user_id = \".$uid.\" AND post_id = \".$pid;\n\t\t\t$result = mysqli_query($this->con, $query);\n\t\t\tif($result){\n\t\t\t\t$vote = ($votetype == 0 ? 1 : - 1);\n\t\t\t\t$query2 = \"UPDATE post SET votes = votes - \".$vote.\" WHERE pid= \".$pid;\n\t\t\t\t$result2 = mysqli_query($this->con, $query2);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}else{\n\t\t\t//user has not voted\n\t\t\t$t = $this->returnNot($votetype);\n\t\t\tif($this->check_user_voted($uid,$pid,$t)){\n\t\t\t\t//user has upvoted / downvoted before that, delete the record of that\n\t\t\t\t$query = \"DELETE FROM votes WHERE user_id = \".$uid.\" AND post_id = \".$pid.\"\";\n\t\t\t\t$result = mysqli_query($this->con, $query);\n\t\t\t\tif($result){\n\t\t\t\t\t$vote = ($votetype == 0 ? 1 : -1 );\n\t\t\t\t\t$query2 = \"UPDATE post SET votes = votes + \".$vote.\" WHERE pid= \".$pid;\n\t\t\t\t\t$result2 = mysqli_query($this->con, $query2);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//increase / decrease the number of votes\n\t\t\t//insert the record of vote into votes tables\n\t\t\t$vote = ($votetype == 0 ? 1 : - 1);\n\t\t\t$query = \"UPDATE post SET votes = votes +\".$vote.\" WHERE pid = \".$pid;\n\t\t\t$result = mysqli_query($this->con, $query);\n\t\t\tif($result){\n\t\t\t\t$query2 = \"INSERT INTO votes (user_id, post_id, votetype) VALUES (\".$uid.\",\".$pid.\",\".$votetype.\")\";\n\t\t\t\t$result2 = mysqli_query($this->con, $query2);\n\t\t\t\tif($result2){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "function snax_show_item_upvote_link( $post = null ) {\n\t$post = get_post( $post );\n\t$bool = true;\n\n\treturn (bool) apply_filters( 'snax_show_item_upvote_link', $bool, $post );\n}", "function noesc_voteup($who)\n{\n if ( (stripos($who, 'id') !== false) || (strpos($who, '/') !== false) ) {\n echo GWF_HTML::error('No Escape', 'Please do not mess with the id. It would break the challenge for others', false);\n return;\n }\n \n \n $db = noesc_db();\n $who = mysql_real_escape_string($who);\n $query = \"UPDATE noescvotes SET `$who`=`$who`+1 WHERE id=1\";\n if (false !== $db->queryWrite($query)) {\n echo GWF_HTML::message('No Escape', 'Vote counted for '.GWF_HTML::display($who), false);\n }\n \n noesc_stop100();\n}", "public function setUpVotes($upVotes): void\n {\n $this->upVotes = $upVotes;\n }", "public function vote_up($question_id)\r\n {\r\n //-- Perform Vote Up\r\n try\r\n {\r\n ORM::factory('post')->vote_up($question_id);\r\n }\r\n catch(Exception $ex)\r\n {\r\n throw new Kohana_User_Exception('Fail to Vote Up', 'Cannot vote up question ID: '.$question_id.'. Caught exception: '.$ex->getMessage());\r\n }\r\n\r\n //-- Fetch Original Question\r\n $question = ORM::factory('post', $question_id);\r\n\r\n //-- Redirect\r\n url::redirect('/questions/detail/'.$question->id.'/'.$question->slug);\r\n }", "function decAnswerVote($id) {\n\t\tglobal $conn;\n\n\t\t// Add vote\n\t\t$sql = \"UPDATE answer SET vote = vote - 1 WHERE id='$id'\";\n\n\t\tif (mysqli_query($conn, $sql)) {\n\t\t\t$last_id = mysqli_insert_id($conn);\n\t\t} else {\n\t\t\t// Error\n\t\t}\n\n\t\t// Get number vote\n\t\t$sql = \"SELECT vote FROM answer WHERE id='$id'\";\n\n\t\t$result = mysqli_query($conn, $sql);\n\n\t\tif (mysqli_num_rows($result) > 0) {\n\t\t\t// Assign every data to a variable\n\t\t\t$row = mysqli_fetch_assoc($result);\n\t\t\t$current_vote = $row[\"vote\"];\n\t\t\techo $current_vote;\n\t\t}\n\t}", "function decQuestionVote($id) {\n\t\tglobal $conn;\n\n\t\t// Add vote\n\t\t$sql = \"UPDATE question SET vote = vote - 1 WHERE id='$id'\";\n\n\t\tif (mysqli_query($conn, $sql)) {\n\t\t\t$last_id = mysqli_insert_id($conn);\n\t\t} else {\n\t\t\t// Error\n\t\t}\n\n\t\t// Get number vote\n\t\t$sql = \"SELECT vote FROM question WHERE id='$id'\";\n\n\t\t$result = mysqli_query($conn, $sql);\n\n\t\tif (mysqli_num_rows($result) > 0) {\n\t\t\t// Assign every data to a variable\n\t\t\t$row = mysqli_fetch_assoc($result);\n\t\t\t$current_vote = $row[\"vote\"];\n\t\t\techo $current_vote;\n\t\t}\n\t}", "public function test_user_can_upvote_post() {\n $user = User::factory()->create();\n $post = Post::factory()->create();\n // $post->upvote($user);\n\n // $this->assertEquals(1, $post->upvotes->count());\n // $this->assertTrue($post->isUpvotedBy($user));\n $this->assertTrue(true);\n }", "public function update_post_vote($post_id)\n {\n $query = \"Update forum Set vote=vote+1 where forum_id=?\";\n $this->db->query($query, $post_id);\n }", "public function vote($vote_type)\n\t{\n\t\t$previous_votes = $this->check_user_previous_votes_for_post($vote_type);\n\n\t\tif ($previous_votes !== 1)\treturn $previous_votes;\n\n\t\tif ($vote_type === 0)\n\t\t{\n\t\t\t$this->down_votes++;\n\n\t\t\t$reputation_type = Model_Reputation::QUESTION_VOTE_DOWN;\n\t\t\t$reputation_type_owner = Model_Reputation::OWN_QUESTION_VOTED_DOWN;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->up_votes++;\n\n\t\t\t$reputation_type = Model_Reputation::QUESTION_VOTE_UP;\n\t\t\t$reputation_type_owner = Model_Reputation::OWN_QUESTION_VOTED_UP;\n\t\t}\n\t\t\n\t\treturn parent::vote_post($reputation_type, $reputation_type_owner);\n\t}", "function test_a_post_cannot_be_downvoted_twice_by_the_same_user(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n // app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n //Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n //app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(-1, $this->post->score);\n }", "public function voteUp() {\n // Parametros da função\n $parametros = ( func_num_args() >= 1 ) ? func_get_arg(0) : array();\n $modelo = $this->load_model('detail-model');\n\n $modelo->setVote($modelo->parametros[0],true);\n\n $movieVoteCount = $modelo->getVoteCount($modelo->parametros[0]);\n\n //print_r($parametros);\n\n print($movieVoteCount[0][\"total\"]);\n }", "public function setDownVotes($downVotes): void\n {\n $this->downVotes = $downVotes;\n }", "public function givevote($vote_id, $option_id, $voter_id) {\r\n if ($option_id and $this->is_open($vote_id)) {\r\n $query = $this->prepare('INSERT INTO voted (voted, voter) VALUES (?, ?)');\r\n if ($query->execute(array($vote_id, $voter_id))) {\r\n $this->prepare('UPDATE choices SET votes = votes + 1 WHERE id = ?')->execute(array($option_id));\r\n return true;\r\n }\r\n }\r\n return false;\r\n }", "public function voteUp(ParaObject $obj = null, $voterid = null) {\n\t\tif ($obj == null || $voterid == null) {\n\t\t\treturn false;\n\t\t}\n\t\treturn $this->getEntity($this->invokePatch($obj->getObjectURI(), array(\"_voteup\" => $voterid))) == \"true\";\n\t}", "private function updateVotes($submission_id)\r\n\t{\r\n \t$votes = $this->db->query($this->table,\r\n \t\t\"SELECT SUM(vote), COUNT(*) FROM $this->table WHERE submission_id = ?\",\r\n \t\t[$submission_id]\r\n \t\t)\r\n \t\t->fetch();\r\n\r\n \t$yesVotes \t= (int) $votes['SUM(vote)'];\r\n \t$voters \t= (int) $votes['COUNT(*)'];\r\n \t// Everyones voted and the majority vote is yes\r\n \tif ($yesVotes > (0.5 * $voters)) {\r\n \t\t$subs = new SubmissionController();\r\n \t\t$subs->publish($submission_id);\r\n \t}\r\n\t}", "public function toggle_downvote($ForumQuestionID)\n\t{\n\t\t//deleting old possitive vote\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>1\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->delete('tblforumqxvote',$where);\n\t\t\n\t\t//inserting new data\n\t\t$data=NULL;\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->get('tblforumqxvote')\n\t\t\t->result();\n\t\tif(count($data)===0)\n\t\t{\n\t\t\t$Insert_Data=NULL;\n\t\t\t$Insert_Data=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t\t'VoteType'=>-1\n\t\t\t];\n\t\t\t$this->db->insert('tblforumqxvote',$Insert_Data);\n\t\t}\n\t\telse //deleting old negetive vote\n\t\t{\n\t\t\t$where=NULL;\n\t\t\t$where=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID\n\t\t\t];\n\t\t\t$data=$this->db\n\t\t\t\t->where($where)\n\t\t\t\t->delete('tblforumqxvote',$where);\n\t\t}\n\t}", "function test_a_post_cannot_be_upvoted_twice_by_the_same_user(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::upvote($this->post);\n // cargamos el repositorio para poder votar por le post\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n // Vote::upvote($this->post);\n // cargamos el repositorio para poder votar por le post\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n // verificamos si hay cambio en una tabla espesifica en la DB\n /**$this->assertDatabaseHas('votes', [\n 'post_id' => $post->id,\n 'user_id' => $user->id,\n 'vote' => 1\n ]);**/\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(1, $this->post->score);\n }", "function comment_upvoted($comment_id = 0, $user_id = 0)\n{\n $CI =& get_instance();\n $CI->load->model('vote/vote_model', 'vote');\n\n return $CI->vote->user_has_upvoted_comment($comment_id, $user_id);\n}", "public function voteUpBlog()\n\t{\n\t\tif (Auth::check()) {\n\n\t\t $id = Request::input('blog_id');\n\t\t $blog = Blog::find($id);\n\t\t $blog->likes += 1;\n\t\t $blog->rank = $blog->likes * 0.35 + $blog->dislikes * 0.25 + $blog->views * 0.4;\n\t\t $blog->save();\n\n\t\t $user_id = Auth::user()->id;\n\t\t $blog->userVoteUpBlogs()->sync([$user_id], false);\n\t\t} else {\n\n\t\t\treturn response()->json(['redirect' => 1]);\n\t\t}\n\n\t}", "function test_a_post_can_be_upvoted(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::upvote($this->post);\n // cargamos el repositorio para poder votar por le post\n // app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n // verificamos si hay cambio en una tabla espesifica en la DB\n $this->assertDatabaseHas('votes', [\n 'post_id' => $this->post->id,\n 'user_id' => $this->user->id,\n 'vote' => 1\n ]);\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(1, $this->post->score);\n }", "function addAnswerVote($id) {\n\t\tglobal $conn;\n\n\t\t// Add vote\n\t\t$sql = \"UPDATE answer SET vote = 1 + vote WHERE id='$id'\";\n\n\t\tif (mysqli_query($conn, $sql)) {\n\t\t\t$last_id = mysqli_insert_id($conn);\n\t\t} else {\n\t\t\t// Error\n\t\t}\n\n\t\t// Get number vote\n\t\t$sql = \"SELECT vote FROM answer WHERE id='$id'\";\n\n\t\t$result = mysqli_query($conn, $sql);\n\n\t\tif (mysqli_num_rows($result) > 0) {\n\t\t\t// Assign every data to a variable\n\t\t\t$row = mysqli_fetch_assoc($result);\n\t\t\t$current_vote = $row[\"vote\"];\n\t\t\techo $current_vote;\n\t\t}\n\t}" ]
[ "0.6506711", "0.6472929", "0.6450667", "0.64353466", "0.6414272", "0.6394279", "0.63885236", "0.6356393", "0.6310909", "0.6302353", "0.62419724", "0.61975485", "0.61601365", "0.6113587", "0.6013319", "0.60115683", "0.5955854", "0.5913624", "0.59065837", "0.5886924", "0.58147323", "0.5787125", "0.5785548", "0.57741934", "0.57529604", "0.5748373", "0.5746412", "0.56955415", "0.5675778", "0.56161606" ]
0.72041744
0
toggle dwonvote of Answer
public function toggle_ans_downvote($ForumAnswerID) { //deleting old possitive vote $where=NULL; $where=[ 'ForumAID'=>$ForumAnswerID, 'UserID'=>$this->session->UserID, 'VoteType'=>1 ]; $data=$this->db ->where($where) ->delete('tblforumaxvote',$where); //inserting new data $data=NULL; $where=NULL; $where=[ 'ForumAID'=>$ForumAnswerID, 'UserID'=>$this->session->UserID ]; $data=$this->db ->where($where) ->get('tblforumaxvote') ->result(); if(count($data)===0) { $Insert_Data=NULL; $Insert_Data=[ 'ForumAID'=>$ForumAnswerID, 'UserID'=>$this->session->UserID, 'VoteType'=>-1 ]; $this->db->insert('tblforumaxvote',$Insert_Data); } else //deleting old negetive vote { $where=NULL; $where=[ 'ForumAID'=>$ForumAnswerID, 'UserID'=>$this->session->UserID ]; $data=$this->db ->where($where) ->delete('tblforumaxvote',$where); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toggle_ans_upvote($ForumAnswerID)\n\t{\n\t\t//deleting old negetive vote\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>-1\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->delete('tblforumaxvote',$where);\n\t\n\t\t//inserting new data\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t'UserID'=>$this->session->UserID\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->get('tblforumaxvote')\n\t\t\t->result();\n\t\tif(count($data)===0)\n\t\t{\n\t\t\t$Insert_Data=NULL;\n\t\t\t$Insert_Data=[\n\t\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t\t'VoteType'=>1\n\t\t\t];\n\t\t\t$this->db->insert('tblforumaxvote',$Insert_Data);\n\t\t}\n\t\telse //deleting old positive vote\n\t\t{\n\t\t\t$where=NULL;\n\t\t\t$where=[\n\t\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t\t'UserID'=>$this->session->UserID\n\t\t\t];\n\t\t\t$data=$this->db\n\t\t\t\t->where($where)\n\t\t\t\t->delete('tblforumaxvote',$where);\n\t\t}\n\t}", "public function toggle_reply()\n {\n }", "public function update_rating($answer_id, $vote){\n\t\tif($vote == \"up\"){\n\t\t\t$this->db->set(\"rating\", \"rating+1\", FALSE);\n\t\t}\n\t\telse if($vote == \"down\"){\n\t\t\t$this->db->set(\"rating\", \"rating-1\", FALSE);\n\t\t}\n\t\t$this->db->where(\"answer_id\", $answer_id);\n\t\t$this->db->update(\"answers\");\n\t}", "function bbp_get_reply_toggles($reply_id = 0)\n{\n}", "function decAnswerVote($id) {\n\t\tglobal $conn;\n\n\t\t// Add vote\n\t\t$sql = \"UPDATE answer SET vote = vote - 1 WHERE id='$id'\";\n\n\t\tif (mysqli_query($conn, $sql)) {\n\t\t\t$last_id = mysqli_insert_id($conn);\n\t\t} else {\n\t\t\t// Error\n\t\t}\n\n\t\t// Get number vote\n\t\t$sql = \"SELECT vote FROM answer WHERE id='$id'\";\n\n\t\t$result = mysqli_query($conn, $sql);\n\n\t\tif (mysqli_num_rows($result) > 0) {\n\t\t\t// Assign every data to a variable\n\t\t\t$row = mysqli_fetch_assoc($result);\n\t\t\t$current_vote = $row[\"vote\"];\n\t\t\techo $current_vote;\n\t\t}\n\t}", "public function toggleShowLastSurveyAndQuestion()\n {\n if ( Permission::model()->hasGlobalPermission('settings', 'update') )\n {\n $bNewShowLastSurveyAndQuestion = (getGlobalSetting('show_last_survey_and_question')==\"show\")?\"hide\":\"show\";\n setGlobalSetting('show_last_survey_and_question', $bNewShowLastSurveyAndQuestion);\n echo $bNewShowLastSurveyAndQuestion;\n }\n }", "public function toggleAnswer($ForumQID=FALSE, $ForumAID=FALSE)\n\t{\n\t\tif($ForumQID && $ForumAID && is_numeric($ForumQID) && is_numeric($ForumAID))\n\t\t{\n\t\t\t$this->model->toggle_answer_status($ForumAID);\n\t\t\tredirect('admin/ForumQuestion/'.$ForumQID);\n\t\t}\n\t\telse\n\t\t\tredirect('admin/Error_404');\n\t}", "function set_identity_answering_status($telegram_id, $riddle_id) {\n return change_identity_status($telegram_id, IDENTITY_STATUS_ANSWERING, $riddle_id);\n}", "function decQuestionVote($id) {\n\t\tglobal $conn;\n\n\t\t// Add vote\n\t\t$sql = \"UPDATE question SET vote = vote - 1 WHERE id='$id'\";\n\n\t\tif (mysqli_query($conn, $sql)) {\n\t\t\t$last_id = mysqli_insert_id($conn);\n\t\t} else {\n\t\t\t// Error\n\t\t}\n\n\t\t// Get number vote\n\t\t$sql = \"SELECT vote FROM question WHERE id='$id'\";\n\n\t\t$result = mysqli_query($conn, $sql);\n\n\t\tif (mysqli_num_rows($result) > 0) {\n\t\t\t// Assign every data to a variable\n\t\t\t$row = mysqli_fetch_assoc($result);\n\t\t\t$current_vote = $row[\"vote\"];\n\t\t\techo $current_vote;\n\t\t}\n\t}", "function bbp_toggle_reply($args = array())\n{\n}", "function test_a_user_ca_switch_from_downvote_to_upvote(){\n // llamamos a la funcion downVote para darle un punto negativo al post\n // Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n //app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n // Vote::upvote($this->post);\n // cargamos el repositorio para crear un voto\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(1, $this->post->score);\n }", "private function updateVotes($submission_id)\r\n\t{\r\n \t$votes = $this->db->query($this->table,\r\n \t\t\"SELECT SUM(vote), COUNT(*) FROM $this->table WHERE submission_id = ?\",\r\n \t\t[$submission_id]\r\n \t\t)\r\n \t\t->fetch();\r\n\r\n \t$yesVotes \t= (int) $votes['SUM(vote)'];\r\n \t$voters \t= (int) $votes['COUNT(*)'];\r\n \t// Everyones voted and the majority vote is yes\r\n \tif ($yesVotes > (0.5 * $voters)) {\r\n \t\t$subs = new SubmissionController();\r\n \t\t$subs->publish($submission_id);\r\n \t}\r\n\t}", "public function setAnswered($id)\n\t{\n\t\t$question = \\App\\Question::find($id);\n\t\t$question->status = \"answered\";\n\t\t$question->save();\n\t\treturn redirect()->to('moderator');\n\t}", "static function correctAnswer($answer){\r\n\t\t$v1 = Session::get(\"mathQuestionV1\");\r\n\t\t$v2 = Session::get(\"mathQuestionV2\");\r\n\t\t\r\n\t\tSession::clear('mathQuestionV1');\r\n\t\tSession::clear('mathQuestionV2');\r\n\t\t\r\n\t\tif(MathSpamProtection::digitToWord($v1 + $v2) == $answer || ($v1 + $v2) == $answer){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t\t\r\n\t}", "function test_a_user_ca_switch_from_upvote_to_downvote(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::upvote($this->post);\n // cargamos el repositorio para poder votar por le post\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n // Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n //app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(-1, $this->post->score);\n }", "public function toggle_upvote($ForumQuestionID)\n\t{\n\t\t//deleting old negetive vote\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>-1\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->delete('tblforumqxvote',$where);\n\t\n\t\t//inserting new data\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->get('tblforumqxvote')\n\t\t\t->result();\n\t\tif(count($data)===0)\n\t\t{\n\t\t\t$Insert_Data=NULL;\n\t\t\t$Insert_Data=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t\t'VoteType'=>1\n\t\t\t];\n\t\t\t$this->db->insert('tblforumqxvote',$Insert_Data);\n\t\t}\n\t\telse //deleting old positive vote\n\t\t{\n\t\t\t$where=NULL;\n\t\t\t$where=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID\n\t\t\t];\n\t\t\t$data=$this->db\n\t\t\t\t->where($where)\n\t\t\t\t->delete('tblforumqxvote',$where);\n\t\t}\n\t}", "public function toggle_downvote($ForumQuestionID)\n\t{\n\t\t//deleting old possitive vote\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>1\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->delete('tblforumqxvote',$where);\n\t\t\n\t\t//inserting new data\n\t\t$data=NULL;\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->get('tblforumqxvote')\n\t\t\t->result();\n\t\tif(count($data)===0)\n\t\t{\n\t\t\t$Insert_Data=NULL;\n\t\t\t$Insert_Data=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t\t'VoteType'=>-1\n\t\t\t];\n\t\t\t$this->db->insert('tblforumqxvote',$Insert_Data);\n\t\t}\n\t\telse //deleting old negetive vote\n\t\t{\n\t\t\t$where=NULL;\n\t\t\t$where=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID\n\t\t\t];\n\t\t\t$data=$this->db\n\t\t\t\t->where($where)\n\t\t\t\t->delete('tblforumqxvote',$where);\n\t\t}\n\t}", "public function updated(Answer $answer)\n {\n //\n }", "public function toggleIt($caller)\n {\n if ($this->exists) {\n $this->delete();\n $caller->setUnvotedMessage();\n\n } else {\n $this->save();\n }\n\n }", "public function toggleVac(){\n $q = $this->_conn->prepare('SELECT `state` FROM `state` WHERE id = :id');\n $q->execute(['id' => 1]);\n $data = $q->fetch(PDO::FETCH_ASSOC);\n if($data['state'] == \"false\"){\n $q = $this->_conn->prepare('UPDATE `state` SET `state`= \"true\" WHERE id = :id');\n $q->execute(['id' => 1]);\n }else{\n $q = $this->_conn->prepare('UPDATE `state` SET `state`= \"false\" WHERE id = :id');\n $q->execute(['id' => 1]);\n }\n }", "public function givevote($vote_id, $option_id, $voter_id) {\r\n if ($option_id and $this->is_open($vote_id)) {\r\n $query = $this->prepare('INSERT INTO voted (voted, voter) VALUES (?, ?)');\r\n if ($query->execute(array($vote_id, $voter_id))) {\r\n $this->prepare('UPDATE choices SET votes = votes + 1 WHERE id = ?')->execute(array($option_id));\r\n return true;\r\n }\r\n }\r\n return false;\r\n }", "function updateAnswer( $id_track, &$source ) {\n\t\t\n\t\treturn true;\n\t}", "public function toggle($int)\n {\n $user = User::find($int);\n if ($user->active == 'yes'):\n $user->active = 'no';\n else:\n $user->active = 'yes';\n endif;\n\n if ($user->save()) {\n return print 1;\n } else return print 0;\n }", "function noesc_voteup($who)\n{\n if ( (stripos($who, 'id') !== false) || (strpos($who, '/') !== false) ) {\n echo GWF_HTML::error('No Escape', 'Please do not mess with the id. It would break the challenge for others', false);\n return;\n }\n \n \n $db = noesc_db();\n $who = mysql_real_escape_string($who);\n $query = \"UPDATE noescvotes SET `$who`=`$who`+1 WHERE id=1\";\n if (false !== $db->queryWrite($query)) {\n echo GWF_HTML::message('No Escape', 'Vote counted for '.GWF_HTML::display($who), false);\n }\n \n noesc_stop100();\n}", "function userDoAnswer( $id_track ) {\n\t\t\n\t\t\n\t\t$recover_answer = \"\n\t\tSELECT id_answer \n\t\tFROM \".$GLOBALS['prefix_lms'].\"_polltrack_answer \n\t\tWHERE id_quest = '\".(int)$this->id.\"' AND \n\t\t\tid_track = '\".(int)$id_track.\"'\";\n\t\t$re_answer_do = sql_query($recover_answer);\n\t\t\n\t\tif(mysql_num_rows($re_answer_do)) return true;\n\t\telse return false;\n\t}", "function vote_post($uid, $pid, $votetype){\n\t\tif($this->check_user_voted($uid,$pid,$votetype)){\n\t\t\t//user voted, return\n\t\t\t$query = \"DELETE FROM votes WHERE user_id = \".$uid.\" AND post_id = \".$pid;\n\t\t\t$result = mysqli_query($this->con, $query);\n\t\t\tif($result){\n\t\t\t\t$vote = ($votetype == 0 ? 1 : - 1);\n\t\t\t\t$query2 = \"UPDATE post SET votes = votes - \".$vote.\" WHERE pid= \".$pid;\n\t\t\t\t$result2 = mysqli_query($this->con, $query2);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}else{\n\t\t\t//user has not voted\n\t\t\t$t = $this->returnNot($votetype);\n\t\t\tif($this->check_user_voted($uid,$pid,$t)){\n\t\t\t\t//user has upvoted / downvoted before that, delete the record of that\n\t\t\t\t$query = \"DELETE FROM votes WHERE user_id = \".$uid.\" AND post_id = \".$pid.\"\";\n\t\t\t\t$result = mysqli_query($this->con, $query);\n\t\t\t\tif($result){\n\t\t\t\t\t$vote = ($votetype == 0 ? 1 : -1 );\n\t\t\t\t\t$query2 = \"UPDATE post SET votes = votes + \".$vote.\" WHERE pid= \".$pid;\n\t\t\t\t\t$result2 = mysqli_query($this->con, $query2);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//increase / decrease the number of votes\n\t\t\t//insert the record of vote into votes tables\n\t\t\t$vote = ($votetype == 0 ? 1 : - 1);\n\t\t\t$query = \"UPDATE post SET votes = votes +\".$vote.\" WHERE pid = \".$pid;\n\t\t\t$result = mysqli_query($this->con, $query);\n\t\t\tif($result){\n\t\t\t\t$query2 = \"INSERT INTO votes (user_id, post_id, votetype) VALUES (\".$uid.\",\".$pid.\",\".$votetype.\")\";\n\t\t\t\t$result2 = mysqli_query($this->con, $query2);\n\t\t\t\tif($result2){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public function update_post_vote($post_id)\n {\n $query = \"Update forum Set vote=vote+1 where forum_id=?\";\n $this->db->query($query, $post_id);\n }", "function test_a_post_cannot_be_downvoted_twice_by_the_same_user(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n // app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n //Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n //app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(-1, $this->post->score);\n }", "public function removeAnswer()\n {\n if($this->isCorrect)\n {\n $this->removed = false;\n }\n else\n {\n $this->removed = true;\n }\n }", "function unaccept_partial_answer($answer_id) {\n global $pdo;\n global $msg;\n\n $sql = \"UPDATE `wm_partial_answer` \".\n \"SET `is_accepted` = 0 \".\n \"WHERE `id` = :answer_id \".\n \"AND (`user_id` = :user_id OR :user_id = 10) \"; # TODO: Change to admin-group check\n \"LIMIT 1;\";\n $stmt = $pdo->prepare($sql);\n $uid = get_uid();\n $stmt->bindParam(':user_id', $uid, PDO::PARAM_INT);\n $stmt->bindParam(':answer_id', $answer_id, PDO::PARAM_INT);\n $stmt->execute();\n\n if ($stmt->rowCount() == 1) {\n $msg[] = array(\"class\" => \"alert-success\",\n \"text\" => \"The answer was unaccepted.\");\n return true;\n } else {\n $msg[] = array(\"class\" => \"alert-warning\",\n \"text\" => \"You could not accept that answer. \".\n \"This happens when you try to accept \".\n \"a classification of a formula you \".\n \"did not write. \".\n \"Or multiple form submission.\");\n return false;\n }\n}" ]
[ "0.65235895", "0.6383773", "0.59784514", "0.5849651", "0.5788898", "0.577686", "0.57380277", "0.5736951", "0.5706162", "0.56721663", "0.5656794", "0.56539494", "0.56528574", "0.56485486", "0.56472075", "0.5637495", "0.56321377", "0.5631662", "0.56181395", "0.5576798", "0.55734456", "0.55274194", "0.552695", "0.5500058", "0.544838", "0.5439666", "0.5432033", "0.53914094", "0.53837943", "0.53376824" ]
0.64730984
1
get color vote of perticular Answer
public function getAnsColor($ForumAnswerID,$VoteType) { $where=NULL; $where=[ 'ForumAID'=>$ForumAnswerID, 'UserID'=>$this->session->UserID, 'VoteType'=>$VoteType ]; $this->db->where($where); $data=$this->db->get('tblforumaxvote')->result(); if(count($data)==1) return 0; else return 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hotness_color($upvotes,$downvotes) {\n\n\t\t//$sum = $upvotes - $downvotes;\n\t\t\n\t\t// if ($sum >= 7) {\n\t\t// \t$color = 'red';\n\t\t// } elseif ($sum < 0 ) {\n\t\t// \t$color = '#ccc';\n\t\t// } else {\n\t\t// \t$color = '#fa8900';\n\t\t// }\n\n\t\t//return $color;\n\t\t\n\t\treturn '#fa8900';\n\t}", "public function getColor($ForumQuestionID,$VoteType)\n\t{\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>$VoteType\n\t\t];\n\t\t$this->db->where($where);\n\t\t$data=$this->db->get('tblforumqxvote')->result();\n\t\tif(count($data)==1)\n\t\t\treturn 0;\n\t\telse\t\n\t\t\treturn 1;\n\t}", "function voteGraph ($resultcount,$result,$total){\n \n $width = $resultcount * 10;\n $graphNumber = round(($resultcount/$total) * 100);\n switch($result){\n case \"Yes\":\n $color = \"#009900\";\n break;\n case \"No\":\n $color = \"#990000\";\n break;\n default:\n $color = \"gray\";\n break;\n }\n echo \"<p><div class ='float'><hr size=8 align='left' color='\".$color.\"' width=\".$width.\"/></div><strong>\".$resultcount.\"</strong> \".$result.\" votes - \".$graphNumber.\"%</p>\"; \n }", "function ac_le_shuffle_quiz(){\n\t\t\t$results = $this->q2obj(\"select 'a' as name, 'correct' as status\");\n\t\t\t#conteo de respuestas correctas o incorrectas y operacion para pasar a pixeles\n\t\t\t#el alt del cajon es de 200px.\n\t\t\t$correct_answers = '6' * 20;\n\t\t\t$incorrect_answers = '3' * 20;\n\t\t\t#meter en results los valores\n\t\t\techo($this->s_template(\"shuffle_quiz_results\", $results));\n\t\t}", "function eo_get_dominant_color_from_post_id($postId) {\n $output = \"\";\n $postThumbnailId = get_post_thumbnail_id($postId);\n if(is_numeric($postThumbnailId)) {\n $imageCustomFields = get_post_custom($postThumbnailId);\n $imageDominantColor = $imageCustomFields['img_dominant_color'][0];\n\n if(strlen($imageDominantColor) == 7 ) {\n $output = $imageDominantColor;\n }\n }\n\n return $output;\n}", "public function answerVotes($quiz_id,$question_id) {\t\t\n\t\t$this->votes = 'COUNT(*)';\n\t\treturn $this->find(['quiz_id_fk = ?', $quiz_id], ['group' => 'question'.$question_id, 'order' => 'question'.$question_id.' asc']);\n//\t return $this->db->exec('select question'.$question_id.', COUNT(*) as votes from f8m7o85ldalpqf2m.answers where quiz_id_fk='.$quiz_id.' group by question'.$question_id.' order by votes desc');\n//\t return $this->db->exec('select question'.$question_id.', COUNT(*) as votes from answers where quiz_id_fk='.$quiz_id.' group by question'.$question_id.' order by votes desc');\n\t \n\t}", "function quizbook_results() {\n\n if(isset($_POST['data'])) {\n $answers = $_POST['data'];\n }\n\n $result = 0;\n\n foreach ($answers as $resp) {\n //$question[0] = post_id (question number)\n //$question[1] = user's selected answer\n $question = explode(':', $resp);\n\n \n\n $correct = get_post_meta($question[0], 'correct_answer', true); \n \n //$letter_correct[0] = qb_correct\n //$letter_correct[1] = letter answer\n $letter_correct = explode(':', $correct);\n\n if($letter_correct[1] === $question[1] ) {\n $result += 20;\n }\n\n }\n \n\n $exam_score = array(\n 'score' => $result\n );\n\n header('Content-type: application/json');\n echo json_encode($exam_score);\n die();\n}", "function _pattern_entity_get_voting_score($pid) {\n $criteria = array(\n 'entity_type' => 'patternentity',\n 'entity_id' => $pid,\n 'value_type' => 'points',\n 'function' => 'sum',\n );\n $vote = votingapi_select_results($criteria);\n //dsm($vote);\n if ($vote) {\n return $vote[0]['value'];\n }\n else {\n return 0;\n }\n}", "public function getStatusColor($compliance) {\n\n\t\t$is_yellow = Yii::app()->utility->getOption('kpi_yellow');\n\t\t$is_red = Yii::app()->utility->getOption('kpi_red');\n\n\t\tif ($compliance < $is_red) return 1;\n\t\tif ($compliance < $is_yellow) return 2;\n\t\treturn 3;\n\n\t}", "function assign_color_title($dbc,$rating){\r\n\t\t$q = \"SELECT * FROM other_user_info\";\r\n\t\t$r = mysqli_query($dbc,$q);\r\n\t\twhile($row = mysqli_fetch_assoc($r)){ \r\n\t\t\t\t$arr = explode('-',$row['range']);\r\n\t\t\t\tif($rating >= $arr[0] && $rating <= $arr[1]){\r\n\t\t\t\t\treturn array($row['title'],$row['color']);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}", "public function getColor(){\n return $this->$color;\n }", "function noesc_displayVotes(WC_Challenge $chall)\n{\n $votes = noesc_getVotes();\n echo '<table>';\n echo sprintf('<tr><th>%s</th><th>%s</th><th>%s!</th></tr>', $chall->lang('th_name'), $chall->lang('th_count'), $chall->lang('th_vote'));\n $maxwho = '';\n $max = 0;\n $maxcount = 0;\n // Print Candidate rows\n foreach ($votes as $who => $count)\n {\n if ($who !== 'id') // Skip ID\n {\n $count = (int) $count;\n if ($count > $max) {\n $max = $count;\n $maxwho = $who;\n $maxcount = 1;\n }\n elseif ($count === $max) {\n $maxcount++;\n }\n $button = GWF_Button::generic($chall->lang('btn_vote', array($who)), \"index.php?vote_for=$who\");\n echo sprintf('<tr><td>%s</td><td class=\"gwf_num\">%s</td><td>%s</td></tr>', $who, $count, $button);\n }\n } \n echo '</table>';\n \n // Print best candidate. \n if ($maxcount === 1) {\n echo GWF_Box::box($chall->lang('info_best', array(htmlspecialchars($maxwho))));\n }\n}", "public function getColor();", "public function getTextUnderColor () {}", "public function getColor(){\n return $this->color;\n }", "function colorTracking($status)\n{\n\n if($status == 1 || $status == 2 || $status == 3 || $status == 4){\n $r = 'info';\n }elseif($status == 5){\n $r = 'success';\n }else{\n $r = 'danger';\n }\n\n return $r;\n}", "protected function render_difficulty_index($correct_answers, $total_answers)\n {\n $difficulty_index = round($correct_answers / $total_answers, 2);\n return $this->get_score_bar($difficulty_index * 100);\n \n /*\n * $color = $difficulty_index > 0.75 ? 'orange' : ($difficulty_index < 0.25 ? 'red' : 'green'); return '<span\n * style=\"color: ' . $color . '; font-weight: bold;\">' . $difficulty_index . '</span>';\n */\n }", "public function getDifficultyColor()\n\t{\n\t\tswitch($this->difficulty)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\treturn \"green\";\n\t\t\tcase 1:\n\t\t\t\treturn \"yellow\";\n\t\t\tcase 2:\n\t\t\t\treturn \"Red\";\n\t\t\tdefault:\n\t\t\t\treturn \"green\";\n\t\t}\n\t}", "public function getColorQuantum() { }", "static function getScore($answer, $block);", "function bpoc_contest_show_votes($node) {\n if ($node->type == 'contest') {\n return bpoc_contest_show_contest_votes($node);\n }\n if ($node->type == 'photo_submission') {\n return bpoc_contest_show_submission_votes($node);\n }\n if ($node->type == 'video_submission') {\n return bpoc_contest_show_submission_votes($node);\n }\n}", "function qa_approval_colour($code) {\n switch ($code) {\n case \"y\": return \"green\"; break;\n case \"n\": return \"red\"; break;\n case \"s\": return \"#E260E0\"; break;\n case \"p\": return \"blue\"; break;\n default: return \"\";\n } // switch\n}", "public function getAnswer()\n {\n return $this->answer;\n }", "public function getAnswer()\n {\n return $this->answer;\n }", "public function getCurrentVotes()\r\n {\r\n $this->refresh();\r\n return ArrayHelper::map($this->answers, 'id', 'votes');\r\n }", "public function getColor(){\n //this es en esta clase\n return $this->color;\n }", "public function getColor(){\n //this es en esta clase\n return $this->color;\n }", "public function myVotes($postid){\nglobal $db,$profile_details;\n\n if (isset($profile_details->id)){\n $total=$db->db_query(\"select type from voters where post_id='\".escape_string($postid).\"' and id='\".$profile_details->id.\"' LIMIT 1\");\n $total_e=$db->db_fetch_array($total);\n return $total_e->type;\n }\n}", "function convertAnswer($answer, $questionID){\n\t$arr = explode(\"_\", $questionID, 2); //eg. explode VAS_0 at \"_\"\n\t$questionType = $arr[0]; //take the first item\n\t\n\tif ($questionType!='VAS' && $questionType!='SCORE'){\n\t\t$arr = explode(\"_\", $answer, 2); //eg. explode Anchor_0 at \"_\"\n\t\t$answer = (int) $arr[1]; //take the second item\n\t\t\n\t\treturn (int) $answer;\n\t\t/*\n\t\tif ($questionType=='OTHER')\n\t\treturn 100*($answer); //2 choices for OTHER - 0 or 100\n\t\telse if ($questionType=='ASRM')\n\t\treturn 100*($answer)/4; //5 choices for ASRM - 0, 25, 50, 75, 100\n\t\telse if ($questionType=='QIDS')\n\t\treturn 100*($answer)/3; //4 choices for QIDS - 0, 33.33, 66.66, 100\t\t\n\t\t*/\n\t}\n\telse if ($questionType == 'VAS')\n\treturn (int) $answer;\n}", "private function getBotscore($result)\n {\n $temps = Lava::DataTable();\n\n $temps->addStringColumn('Type')\n ->addNumberColumn('Value')\n ->addRow(['Bot\\'score (%)', $result->scores['cap']['universal'] * 100]);\n\n Lava::GaugeChart(\n 'Chart',\n $temps,\n [\n 'width' => 600,\n 'greenFrom' => 0,\n 'greenTo' => 43,\n 'yellowFrom' => 43,\n 'yellowTo' => 80,\n 'redFrom' => 80,\n 'redTo' => 100,\n 'majorTicks' => [\n 'Human',\n 'Bot',\n ],\n ]\n );\n }" ]
[ "0.64339495", "0.6104241", "0.5964894", "0.54265755", "0.5426436", "0.54252446", "0.52724206", "0.52596307", "0.5233635", "0.52170384", "0.51863307", "0.5075485", "0.5068069", "0.50503165", "0.50337297", "0.502766", "0.5019462", "0.5012694", "0.49879152", "0.49830624", "0.4962676", "0.49621397", "0.49494267", "0.49494267", "0.4939078", "0.49009407", "0.49009407", "0.48976108", "0.48957956", "0.48951057" ]
0.65565366
0
toggle upvote of Question
public function toggle_upvote($ForumQuestionID) { //deleting old negetive vote $where=NULL; $where=[ 'ForumQID'=>$ForumQuestionID, 'UserID'=>$this->session->UserID, 'VoteType'=>-1 ]; $data=$this->db ->where($where) ->delete('tblforumqxvote',$where); //inserting new data $where=NULL; $where=[ 'ForumQID'=>$ForumQuestionID, 'UserID'=>$this->session->UserID ]; $data=$this->db ->where($where) ->get('tblforumqxvote') ->result(); if(count($data)===0) { $Insert_Data=NULL; $Insert_Data=[ 'ForumQID'=>$ForumQuestionID, 'UserID'=>$this->session->UserID, 'VoteType'=>1 ]; $this->db->insert('tblforumqxvote',$Insert_Data); } else //deleting old positive vote { $where=NULL; $where=[ 'ForumQID'=>$ForumQuestionID, 'UserID'=>$this->session->UserID ]; $data=$this->db ->where($where) ->delete('tblforumqxvote',$where); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toggle_ans_upvote($ForumAnswerID)\n\t{\n\t\t//deleting old negetive vote\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>-1\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->delete('tblforumaxvote',$where);\n\t\n\t\t//inserting new data\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t'UserID'=>$this->session->UserID\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->get('tblforumaxvote')\n\t\t\t->result();\n\t\tif(count($data)===0)\n\t\t{\n\t\t\t$Insert_Data=NULL;\n\t\t\t$Insert_Data=[\n\t\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t\t'VoteType'=>1\n\t\t\t];\n\t\t\t$this->db->insert('tblforumaxvote',$Insert_Data);\n\t\t}\n\t\telse //deleting old positive vote\n\t\t{\n\t\t\t$where=NULL;\n\t\t\t$where=[\n\t\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t\t'UserID'=>$this->session->UserID\n\t\t\t];\n\t\t\t$data=$this->db\n\t\t\t\t->where($where)\n\t\t\t\t->delete('tblforumaxvote',$where);\n\t\t}\n\t}", "public function rollbackUpvotes($qid)\n {\n return $this->db->query('update forum_questions set upvotes=upvotes-1 where qid='.$qid);\n }", "public function vote_up($question_id)\r\n {\r\n //-- Perform Vote Up\r\n try\r\n {\r\n ORM::factory('post')->vote_up($question_id);\r\n }\r\n catch(Exception $ex)\r\n {\r\n throw new Kohana_User_Exception('Fail to Vote Up', 'Cannot vote up question ID: '.$question_id.'. Caught exception: '.$ex->getMessage());\r\n }\r\n\r\n //-- Fetch Original Question\r\n $question = ORM::factory('post', $question_id);\r\n\r\n //-- Redirect\r\n url::redirect('/questions/detail/'.$question->id.'/'.$question->slug);\r\n }", "public function toggle_ans_downvote($ForumAnswerID)\n\t{\n\t\t//deleting old possitive vote\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>1\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->delete('tblforumaxvote',$where);\n\t\t\n\t\t//inserting new data\n\t\t$data=NULL;\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t'UserID'=>$this->session->UserID\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->get('tblforumaxvote')\n\t\t\t->result();\n\t\tif(count($data)===0)\n\t\t{\n\t\t\t$Insert_Data=NULL;\n\t\t\t$Insert_Data=[\n\t\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t\t'VoteType'=>-1\n\t\t\t];\n\t\t\t$this->db->insert('tblforumaxvote',$Insert_Data);\n\t\t}\n\t\telse //deleting old negetive vote\n\t\t{\n\t\t\t$where=NULL;\n\t\t\t$where=[\n\t\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t\t'UserID'=>$this->session->UserID\n\t\t\t];\n\t\t\t$data=$this->db\n\t\t\t\t->where($where)\n\t\t\t\t->delete('tblforumaxvote',$where);\n\t\t}\n\t}", "function test_a_user_ca_switch_from_upvote_to_downvote(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::upvote($this->post);\n // cargamos el repositorio para poder votar por le post\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n // Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n //app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(-1, $this->post->score);\n }", "function test_a_user_ca_switch_from_downvote_to_upvote(){\n // llamamos a la funcion downVote para darle un punto negativo al post\n // Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n //app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n // Vote::upvote($this->post);\n // cargamos el repositorio para crear un voto\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(1, $this->post->score);\n }", "function upvote($user, $name, $id)\n{\n $tryVote = registerVote($user, $name, $id);\n if($tryVote){\n $oldscore = getScore($id);\n $newscore = incScore($id, $oldscore);\n return $newscore;\n }\n else return false;\n \n}", "public function toggle_downvote($ForumQuestionID)\n\t{\n\t\t//deleting old possitive vote\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>1\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->delete('tblforumqxvote',$where);\n\t\t\n\t\t//inserting new data\n\t\t$data=NULL;\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t'UserID'=>$this->session->UserID\n\t\t];\n\t\t$data=$this->db\n\t\t\t->where($where)\n\t\t\t->get('tblforumqxvote')\n\t\t\t->result();\n\t\tif(count($data)===0)\n\t\t{\n\t\t\t$Insert_Data=NULL;\n\t\t\t$Insert_Data=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t\t'VoteType'=>-1\n\t\t\t];\n\t\t\t$this->db->insert('tblforumqxvote',$Insert_Data);\n\t\t}\n\t\telse //deleting old negetive vote\n\t\t{\n\t\t\t$where=NULL;\n\t\t\t$where=[\n\t\t\t\t'ForumQID'=>$ForumQuestionID,\n\t\t\t\t'UserID'=>$this->session->UserID\n\t\t\t];\n\t\t\t$data=$this->db\n\t\t\t\t->where($where)\n\t\t\t\t->delete('tblforumqxvote',$where);\n\t\t}\n\t}", "public function update_rating($answer_id, $vote){\n\t\tif($vote == \"up\"){\n\t\t\t$this->db->set(\"rating\", \"rating+1\", FALSE);\n\t\t}\n\t\telse if($vote == \"down\"){\n\t\t\t$this->db->set(\"rating\", \"rating-1\", FALSE);\n\t\t}\n\t\t$this->db->where(\"answer_id\", $answer_id);\n\t\t$this->db->update(\"answers\");\n\t}", "function snax_show_item_upvote_link( $post = null ) {\n\t$post = get_post( $post );\n\t$bool = true;\n\n\treturn (bool) apply_filters( 'snax_show_item_upvote_link', $bool, $post );\n}", "function vote_post($uid, $pid, $votetype){\n\t\tif($this->check_user_voted($uid,$pid,$votetype)){\n\t\t\t//user voted, return\n\t\t\t$query = \"DELETE FROM votes WHERE user_id = \".$uid.\" AND post_id = \".$pid;\n\t\t\t$result = mysqli_query($this->con, $query);\n\t\t\tif($result){\n\t\t\t\t$vote = ($votetype == 0 ? 1 : - 1);\n\t\t\t\t$query2 = \"UPDATE post SET votes = votes - \".$vote.\" WHERE pid= \".$pid;\n\t\t\t\t$result2 = mysqli_query($this->con, $query2);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}else{\n\t\t\t//user has not voted\n\t\t\t$t = $this->returnNot($votetype);\n\t\t\tif($this->check_user_voted($uid,$pid,$t)){\n\t\t\t\t//user has upvoted / downvoted before that, delete the record of that\n\t\t\t\t$query = \"DELETE FROM votes WHERE user_id = \".$uid.\" AND post_id = \".$pid.\"\";\n\t\t\t\t$result = mysqli_query($this->con, $query);\n\t\t\t\tif($result){\n\t\t\t\t\t$vote = ($votetype == 0 ? 1 : -1 );\n\t\t\t\t\t$query2 = \"UPDATE post SET votes = votes + \".$vote.\" WHERE pid= \".$pid;\n\t\t\t\t\t$result2 = mysqli_query($this->con, $query2);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//increase / decrease the number of votes\n\t\t\t//insert the record of vote into votes tables\n\t\t\t$vote = ($votetype == 0 ? 1 : - 1);\n\t\t\t$query = \"UPDATE post SET votes = votes +\".$vote.\" WHERE pid = \".$pid;\n\t\t\t$result = mysqli_query($this->con, $query);\n\t\t\tif($result){\n\t\t\t\t$query2 = \"INSERT INTO votes (user_id, post_id, votetype) VALUES (\".$uid.\",\".$pid.\",\".$votetype.\")\";\n\t\t\t\t$result2 = mysqli_query($this->con, $query2);\n\t\t\t\tif($result2){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public function getUpvote(): bool {\n return $this->upvote;\n }", "function decQuestionVote($id) {\n\t\tglobal $conn;\n\n\t\t// Add vote\n\t\t$sql = \"UPDATE question SET vote = vote - 1 WHERE id='$id'\";\n\n\t\tif (mysqli_query($conn, $sql)) {\n\t\t\t$last_id = mysqli_insert_id($conn);\n\t\t} else {\n\t\t\t// Error\n\t\t}\n\n\t\t// Get number vote\n\t\t$sql = \"SELECT vote FROM question WHERE id='$id'\";\n\n\t\t$result = mysqli_query($conn, $sql);\n\n\t\tif (mysqli_num_rows($result) > 0) {\n\t\t\t// Assign every data to a variable\n\t\t\t$row = mysqli_fetch_assoc($result);\n\t\t\t$current_vote = $row[\"vote\"];\n\t\t\techo $current_vote;\n\t\t}\n\t}", "public function test_user_can_upvote_post() {\n $user = User::factory()->create();\n $post = Post::factory()->create();\n // $post->upvote($user);\n\n // $this->assertEquals(1, $post->upvotes->count());\n // $this->assertTrue($post->isUpvotedBy($user));\n $this->assertTrue(true);\n }", "public function setUpVotes($upVotes): void\n {\n $this->upVotes = $upVotes;\n }", "function noesc_voteup($who)\n{\n if ( (stripos($who, 'id') !== false) || (strpos($who, '/') !== false) ) {\n echo GWF_HTML::error('No Escape', 'Please do not mess with the id. It would break the challenge for others', false);\n return;\n }\n \n \n $db = noesc_db();\n $who = mysql_real_escape_string($who);\n $query = \"UPDATE noescvotes SET `$who`=`$who`+1 WHERE id=1\";\n if (false !== $db->queryWrite($query)) {\n echo GWF_HTML::message('No Escape', 'Vote counted for '.GWF_HTML::display($who), false);\n }\n \n noesc_stop100();\n}", "function test_a_post_cannot_be_downvoted_twice_by_the_same_user(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n // app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n //Vote::downVote($this->post);\n // cargamos el repositorio para darle un punto negativo al post\n //app(voteRepository::class)->downVote($this->post);\n $this->post->downVote();\n\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(-1, $this->post->score);\n }", "public function update_post_vote($post_id)\n {\n $query = \"Update forum Set vote=vote+1 where forum_id=?\";\n $this->db->query($query, $post_id);\n }", "public function vote($vote_type)\n\t{\n\t\t$previous_votes = $this->check_user_previous_votes_for_post($vote_type);\n\n\t\tif ($previous_votes !== 1)\treturn $previous_votes;\n\n\t\tif ($vote_type === 0)\n\t\t{\n\t\t\t$this->down_votes++;\n\n\t\t\t$reputation_type = Model_Reputation::QUESTION_VOTE_DOWN;\n\t\t\t$reputation_type_owner = Model_Reputation::OWN_QUESTION_VOTED_DOWN;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->up_votes++;\n\n\t\t\t$reputation_type = Model_Reputation::QUESTION_VOTE_UP;\n\t\t\t$reputation_type_owner = Model_Reputation::OWN_QUESTION_VOTED_UP;\n\t\t}\n\t\t\n\t\treturn parent::vote_post($reputation_type, $reputation_type_owner);\n\t}", "function test_a_post_cannot_be_upvoted_twice_by_the_same_user(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::upvote($this->post);\n // cargamos el repositorio para poder votar por le post\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n // Vote::upvote($this->post);\n // cargamos el repositorio para poder votar por le post\n //app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n // verificamos si hay cambio en una tabla espesifica en la DB\n /**$this->assertDatabaseHas('votes', [\n 'post_id' => $post->id,\n 'user_id' => $user->id,\n 'vote' => 1\n ]);**/\n $this->assertSame(1, Vote::count());\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(1, $this->post->score);\n }", "function comment_upvoted($comment_id = 0, $user_id = 0)\n{\n $CI =& get_instance();\n $CI->load->model('vote/vote_model', 'vote');\n\n return $CI->vote->user_has_upvoted_comment($comment_id, $user_id);\n}", "function test_a_post_can_be_upvoted(){\n // llamamos a la funcion upvote para poder votar por le post\n // Vote::upvote($this->post);\n // cargamos el repositorio para poder votar por le post\n // app(voteRepository::class)->upvote($this->post);\n $this->post->upvote();\n\n // verificamos si hay cambio en una tabla espesifica en la DB\n $this->assertDatabaseHas('votes', [\n 'post_id' => $this->post->id,\n 'user_id' => $this->user->id,\n 'vote' => 1\n ]);\n\n // agregamos una nueva columna de score al modelo de post el cual despues de llamar al metodo\n // upvote una sola vez deberia ser igual a \"1\"\n $this->assertSame(1, $this->post->score);\n }", "public function voteUp() {\n // Parametros da função\n $parametros = ( func_num_args() >= 1 ) ? func_get_arg(0) : array();\n $modelo = $this->load_model('detail-model');\n\n $modelo->setVote($modelo->parametros[0],true);\n\n $movieVoteCount = $modelo->getVoteCount($modelo->parametros[0]);\n\n //print_r($parametros);\n\n print($movieVoteCount[0][\"total\"]);\n }", "private function updateVotes($submission_id)\r\n\t{\r\n \t$votes = $this->db->query($this->table,\r\n \t\t\"SELECT SUM(vote), COUNT(*) FROM $this->table WHERE submission_id = ?\",\r\n \t\t[$submission_id]\r\n \t\t)\r\n \t\t->fetch();\r\n\r\n \t$yesVotes \t= (int) $votes['SUM(vote)'];\r\n \t$voters \t= (int) $votes['COUNT(*)'];\r\n \t// Everyones voted and the majority vote is yes\r\n \tif ($yesVotes > (0.5 * $voters)) {\r\n \t\t$subs = new SubmissionController();\r\n \t\t$subs->publish($submission_id);\r\n \t}\r\n\t}", "function decAnswerVote($id) {\n\t\tglobal $conn;\n\n\t\t// Add vote\n\t\t$sql = \"UPDATE answer SET vote = vote - 1 WHERE id='$id'\";\n\n\t\tif (mysqli_query($conn, $sql)) {\n\t\t\t$last_id = mysqli_insert_id($conn);\n\t\t} else {\n\t\t\t// Error\n\t\t}\n\n\t\t// Get number vote\n\t\t$sql = \"SELECT vote FROM answer WHERE id='$id'\";\n\n\t\t$result = mysqli_query($conn, $sql);\n\n\t\tif (mysqli_num_rows($result) > 0) {\n\t\t\t// Assign every data to a variable\n\t\t\t$row = mysqli_fetch_assoc($result);\n\t\t\t$current_vote = $row[\"vote\"];\n\t\t\techo $current_vote;\n\t\t}\n\t}", "public function voteUp(ParaObject $obj = null, $voterid = null) {\n\t\tif ($obj == null || $voterid == null) {\n\t\t\treturn false;\n\t\t}\n\t\treturn $this->getEntity($this->invokePatch($obj->getObjectURI(), array(\"_voteup\" => $voterid))) == \"true\";\n\t}", "public function update_voted($data){\n\t\t$this->db->insert(\"voted\", $data);\n\t}", "public function update(Request $request, VoteQuestion $voteQuestion)\n {\n //\n }", "public function toggleIt($caller)\n {\n if ($this->exists) {\n $this->delete();\n $caller->setUnvotedMessage();\n\n } else {\n $this->save();\n }\n\n }", "public function givevote($vote_id, $option_id, $voter_id) {\r\n if ($option_id and $this->is_open($vote_id)) {\r\n $query = $this->prepare('INSERT INTO voted (voted, voter) VALUES (?, ?)');\r\n if ($query->execute(array($vote_id, $voter_id))) {\r\n $this->prepare('UPDATE choices SET votes = votes + 1 WHERE id = ?')->execute(array($option_id));\r\n return true;\r\n }\r\n }\r\n return false;\r\n }" ]
[ "0.7202644", "0.6795511", "0.658334", "0.6444459", "0.642134", "0.6417389", "0.6325814", "0.62676793", "0.6259827", "0.6227494", "0.62140876", "0.6168763", "0.6091078", "0.6070565", "0.6060934", "0.604006", "0.59009814", "0.5881101", "0.5878627", "0.5820032", "0.57920724", "0.5789495", "0.57817054", "0.5764057", "0.57438624", "0.5712704", "0.5704862", "0.5700028", "0.5696669", "0.56952155" ]
0.69796413
1
get color vote of perticular question
public function getColor($ForumQuestionID,$VoteType) { $where=NULL; $where=[ 'ForumQID'=>$ForumQuestionID, 'UserID'=>$this->session->UserID, 'VoteType'=>$VoteType ]; $this->db->where($where); $data=$this->db->get('tblforumqxvote')->result(); if(count($data)==1) return 0; else return 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAnsColor($ForumAnswerID,$VoteType)\n\t{\n\t\t$where=NULL;\n\t\t$where=[\n\t\t\t'ForumAID'=>$ForumAnswerID,\n\t\t\t'UserID'=>$this->session->UserID,\n\t\t\t'VoteType'=>$VoteType\n\t\t];\n\t\t$this->db->where($where);\n\t\t$data=$this->db->get('tblforumaxvote')->result();\n\t\tif(count($data)==1)\n\t\t\treturn 0;\n\t\telse\t\n\t\t\treturn 1;\n\t}", "public function hotness_color($upvotes,$downvotes) {\n\n\t\t//$sum = $upvotes - $downvotes;\n\t\t\n\t\t// if ($sum >= 7) {\n\t\t// \t$color = 'red';\n\t\t// } elseif ($sum < 0 ) {\n\t\t// \t$color = '#ccc';\n\t\t// } else {\n\t\t// \t$color = '#fa8900';\n\t\t// }\n\n\t\t//return $color;\n\t\t\n\t\treturn '#fa8900';\n\t}", "function voteGraph ($resultcount,$result,$total){\n \n $width = $resultcount * 10;\n $graphNumber = round(($resultcount/$total) * 100);\n switch($result){\n case \"Yes\":\n $color = \"#009900\";\n break;\n case \"No\":\n $color = \"#990000\";\n break;\n default:\n $color = \"gray\";\n break;\n }\n echo \"<p><div class ='float'><hr size=8 align='left' color='\".$color.\"' width=\".$width.\"/></div><strong>\".$resultcount.\"</strong> \".$result.\" votes - \".$graphNumber.\"%</p>\"; \n }", "public function getStatusColor($compliance) {\n\n\t\t$is_yellow = Yii::app()->utility->getOption('kpi_yellow');\n\t\t$is_red = Yii::app()->utility->getOption('kpi_red');\n\n\t\tif ($compliance < $is_red) return 1;\n\t\tif ($compliance < $is_yellow) return 2;\n\t\treturn 3;\n\n\t}", "function assign_color_title($dbc,$rating){\r\n\t\t$q = \"SELECT * FROM other_user_info\";\r\n\t\t$r = mysqli_query($dbc,$q);\r\n\t\twhile($row = mysqli_fetch_assoc($r)){ \r\n\t\t\t\t$arr = explode('-',$row['range']);\r\n\t\t\t\tif($rating >= $arr[0] && $rating <= $arr[1]){\r\n\t\t\t\t\treturn array($row['title'],$row['color']);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}", "function ac_le_shuffle_quiz(){\n\t\t\t$results = $this->q2obj(\"select 'a' as name, 'correct' as status\");\n\t\t\t#conteo de respuestas correctas o incorrectas y operacion para pasar a pixeles\n\t\t\t#el alt del cajon es de 200px.\n\t\t\t$correct_answers = '6' * 20;\n\t\t\t$incorrect_answers = '3' * 20;\n\t\t\t#meter en results los valores\n\t\t\techo($this->s_template(\"shuffle_quiz_results\", $results));\n\t\t}", "public function getColor(){\n return $this->$color;\n }", "function eo_get_dominant_color_from_post_id($postId) {\n $output = \"\";\n $postThumbnailId = get_post_thumbnail_id($postId);\n if(is_numeric($postThumbnailId)) {\n $imageCustomFields = get_post_custom($postThumbnailId);\n $imageDominantColor = $imageCustomFields['img_dominant_color'][0];\n\n if(strlen($imageDominantColor) == 7 ) {\n $output = $imageDominantColor;\n }\n }\n\n return $output;\n}", "function colorTracking($status)\n{\n\n if($status == 1 || $status == 2 || $status == 3 || $status == 4){\n $r = 'info';\n }elseif($status == 5){\n $r = 'success';\n }else{\n $r = 'danger';\n }\n\n return $r;\n}", "public function getDifficultyColor()\n\t{\n\t\tswitch($this->difficulty)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\treturn \"green\";\n\t\t\tcase 1:\n\t\t\t\treturn \"yellow\";\n\t\t\tcase 2:\n\t\t\t\treturn \"Red\";\n\t\t\tdefault:\n\t\t\t\treturn \"green\";\n\t\t}\n\t}", "public function getColorQuantum() { }", "public function getColor(){\n return $this->color;\n }", "public function answerVotes($quiz_id,$question_id) {\t\t\n\t\t$this->votes = 'COUNT(*)';\n\t\treturn $this->find(['quiz_id_fk = ?', $quiz_id], ['group' => 'question'.$question_id, 'order' => 'question'.$question_id.' asc']);\n//\t return $this->db->exec('select question'.$question_id.', COUNT(*) as votes from f8m7o85ldalpqf2m.answers where quiz_id_fk='.$quiz_id.' group by question'.$question_id.' order by votes desc');\n//\t return $this->db->exec('select question'.$question_id.', COUNT(*) as votes from answers where quiz_id_fk='.$quiz_id.' group by question'.$question_id.' order by votes desc');\n\t \n\t}", "private function getColorOfCom()\n {\n $sql1 = \"SELECT `com_fulldesc` FROM `shop_commodity` WHERE `commodity_ID` = {$this->comId}\";\n $response = $this->db->query($sql1);\n if ($response) {\n $row = $response->fetch_assoc();\n $comDescString = $row[\"com_fulldesc\"];\n } else {\n $this->comColor = \"\";\n return;\n }\n $needle = \"Цвет:\";\n $findColor = strstr($comDescString, $needle);\n if ($findColor !== false) {\n $this->comColor = str_replace(\"Цвет:</span>\", \"\",\n strstr($findColor, \"</p>\", true));\n } else {\n $sql2 = \"SELECT `list_realname` FROM `shop_filters-values` INNER JOIN\n `shop_filters-lists`\n ON `ticket_value`=`id`\n WHERE `ticket_id`={$this->comId} AND `ticket_filterid`=9 \";\n $response = $this->db->query($sql2);\n if ($response) {\n $row = $response->fetch_assoc();\n $this->comColor = $row[\"list_realname\"];\n } else {\n $this->comColor = \"\";\n }\n }\n }", "function get_random_question_from_theme($sujet)\r\n{\r\n\r\n\t$prob = rand(1,100);\r\n\r\n\tif ($prob > 9 AND $prob < 100)\r\n\t{\r\n\t\t$prob = 90;\r\n\t}\r\n\telse if ($prob > 1 AND $prob < 9)\r\n\t{\r\n\t\t$prob = 9;\r\n\t}\r\n\r\n\t$nvProb = array(1 => 90,\r\n\t\t\t\t 2 => 9,\r\n\t\t\t\t 3 => 1);\r\n\r\n\t$nvQ = array_search($prob, $nvProb);\r\n\r\n\t$link = open_database_connection();\r\n\r\n\t$query = '\r\n\t\t\t\tSELECT IDQuestion, Question, bonnerep, mauvaiserep1, mauvaiserep2, mauvaiserep3\r\n\t\t\t\tFROM question\r\n\t\t\t\tWHERE NvQuestion = '.$nvQ.'\r\n\t\t\t\t\t AND NomSujet = \"'.$sujet.'\"\r\n\t\t\t\tORDER BY RAND()\r\n\t\t\t\tLIMIT 1';\r\n\t$result = mysqli_query($link, $query);\r\n\t$selectedQ = mysqli_fetch_assoc($result);\r\n\r\n\tmysqli_free_result($result);\r\n\tclose_database_connection($link);\r\n\treturn $selectedQ;\r\n}", "function _pattern_entity_get_voting_score($pid) {\n $criteria = array(\n 'entity_type' => 'patternentity',\n 'entity_id' => $pid,\n 'value_type' => 'points',\n 'function' => 'sum',\n );\n $vote = votingapi_select_results($criteria);\n //dsm($vote);\n if ($vote) {\n return $vote[0]['value'];\n }\n else {\n return 0;\n }\n}", "public function getColor();", "public function getColor(){\n //this es en esta clase\n return $this->color;\n }", "public function getColor(){\n //this es en esta clase\n return $this->color;\n }", "function gradeQuestion($q, &$sobj, &$review=FALSE, &$hist=FALSE) {\n $slug = $q['slug'];\n\n if ($q['points'] <= 0) return FALSE;\n\n // being manually graded should not bypass histogram computation\n $graded = false;\n if (isset($sobj[$slug]) && isset($sobj[$slug]['grade']) && is_numeric($sobj[$slug]['grade'])) {\n $graded = true;\n $earn = $sobj[$slug]['grade'];\n }\n \n if (isset($q['rubric'])) {\n\n if (!isset($sobj[$slug]['rubric'])) {\n if ($review !== FALSE)\n $review[\"$slug-pending\"][] = $sobj['slug'];\n return FALSE;\n }\n if ($hist !== FALSE && !isset($hist[$slug]))\n $hist[$slug] = array('right'=>0,'total'=>0);\n if (!$graded) {\n $earn = 0;\n $of = 0;\n $finished = true;\n foreach($q['rubric'] as $i=>$obj) {\n if ($obj['hide']) continue;\n $of += $obj['points'];\n if (isset($sobj[$slug]['rubric'][$i]))\n $earn += $obj['points']*$sobj[$slug]['rubric'][$i];\n else $finished = false;\n }\n $earn /= $of;\n if ($review !== FALSE) {\n if (!isset($review[\"$slug-pending\"])) $review[\"$slug-pending\"] = array();\n if ($finished) $review[\"$slug-graded\"][] = $sobj['slug'];\n else $review[\"$slug-pending\"][] = $sobj['slug'];\n }\n } else if ($review !== FALSE)\n $review[\"$slug-graded\"][] = $sobj['slug'];\n } else if ($q['type'] == 'image') return FALSE;\n else if ($q['type'] == 'text' || $q['type'] == 'box') {\n if (!isset($q['key'])) return FALSE;\n\n if ($hist !== FALSE && !isset($hist[$slug]))\n $hist[$slug] = array('right'=>0,'total'=>0);\n if (!$graded) {\n $earn = 0;\n if (isset($sobj[$slug])) {\n $resp = trim($sobj[$slug]['answer'][0]);\n foreach($q['key'] as $key) {\n $k = $key['text'];\n $match = ($k[0] == '/') ? preg_match($k, $resp) : $k == $resp;\n if ($match && $key['points'] > $earn) $earn = $key['points'];\n }\n if (file_exists(\"log/$q[quizid]/key_$slug.json\")) {\n $obj = json_decode(file_get_contents(\"log/$q[quizid]/key_$slug.json\"), true);\n if (isset($obj[$resp]) && is_numeric($obj[$resp]))\n $earn = $obj[$resp];\n }\n if ($review !== FALSE && round($earn,6) != 1 && $resp) {\n if (!isset($review[\"$slug-answers\"]))\n $review[\"$slug-answers\"] = array();\n if (isset($review[\"$slug-answers\"][$resp]))\n $review[\"$slug-answers\"][$resp][] = $sobj['slug'];\n else\n $review[\"$slug-answers\"][$resp] = array($sobj['slug']);\n }\n if ($review !== FALSE && round($earn,6) != 1 && $sobj[$slug]['comments'])\n $review[$slug][] = $sobj['slug'];\n }\n }\n if ($hist !== FALSE) {\n $hist[$slug]['right'] += $earn;\n $hist[$slug]['total'] += 1;\n }\n } else {\n // assert(isset($q['options']));\n if ($hist !== FALSE && !isset($hist[$slug]))\n $hist[$slug] = array('right'=>0,'total'=>0);\n if (!$graded) $earn = $q['blank'];\n if (isset($sobj[$slug]['answer'])) {\n $resp = $sobj[$slug]['answer'];\n//error_log(json_encode($resp));\n foreach($q['options'] as $opt)\n if (in_array($opt['slug'],$resp)) {\n if (!$graded) {\n if ($q['type'] == 'checkbox') $earn += $opt['points'];\n else $earn = max($earn, $opt['points']);\n }\n if ($hist !== FALSE)\n if (isset($hist[$slug][$opt['slug']]))\n $hist[$slug][$opt['slug']] += 1;\n else\n $hist[$slug][$opt['slug']] = 1;\n }\n if ($review !== FALSE && round($earn,6) != 1 \n && ($sobj[$slug]['comments']))\n $review[$slug][] = $sobj['slug'];\n }\n }\n if ($review !== FALSE && isset($sobj[$slug]['regrade']))\n $review[$slug][] = $sobj['slug'];\n \n $sobj[$slug]['score'] = round($earn*$q['points'], 6);\n if ($hist !== FALSE) {\n $hist[$slug]['right'] += $sobj[$slug]['score'];\n $hist[$slug]['total'] += 1;\n }\n return $earn;\n}", "public function getColor(){\n\t\t//Busca en esta clase la propiedad x\n\t\treturn $this->color;\n\t}", "function qa_approval_colour($code) {\n switch ($code) {\n case \"y\": return \"green\"; break;\n case \"n\": return \"red\"; break;\n case \"s\": return \"#E260E0\"; break;\n case \"p\": return \"blue\"; break;\n default: return \"\";\n } // switch\n}", "public function getWidgetColor() {\n return ($this->getData('widget_type') == Ntoklo_Recommendations_Model_Service::CALL_METHOD_CHART) ? $this->getData('widget_color_chart') : $this->getData('widget_color_recommendations');\n }", "abstract protected function getColor();", "public function getTextUnderColor () {}", "public\tfunction\tgetColor()\t{\n\t\t\t\t\t\t\t\t\t\t\t\treturn\t$this->color;\n\t\t\t\t\t\t\t\t}", "function getColor()\n {\n return $this->readColor();\n }", "function getColor() {\n\t\treturn $this->color;\n\t}", "public function getColor(){\n\n return $this->_color;\n }", "function getColor($color) {\t \r\n\t\treturn $this->colors[$color]; \r\n\t}" ]
[ "0.6135918", "0.6098639", "0.55844414", "0.558155", "0.5444498", "0.5409117", "0.5396033", "0.5266038", "0.52250326", "0.5213255", "0.5196826", "0.51925105", "0.5169714", "0.5155198", "0.5139682", "0.51284826", "0.50841695", "0.5072574", "0.5072574", "0.50639915", "0.5051024", "0.50342363", "0.5016124", "0.49933714", "0.49833962", "0.49745378", "0.49613062", "0.4924857", "0.49240145", "0.4921135" ]
0.6275961
0
Show the form for creating a new Assistance.
public function create() { return view('assistances.create'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n $examtype = new Examtype();\n $this->authorize('create', $examtype);\n\n\n return view('appl.exam.examtype.createedit')\n ->with('stub','Create')\n ->with('examtype',$examtype);\n }", "public function create()\n {\n return view('admin.exam.create');\n }", "protected function form()\n {\n return Form::make(new Assistance(), function (Form $form) {\n $form->display('id');\n $form->text('user_id','用户id')->help('后台发起应援填写一个用户');\n $form->text('name');\n $form->text('star');\n// $form->text('xid');\n $form->select('xid','项目')->options(config('app.url').'/api/cate')->required();\n $form->text('endtime');\n $form->image('img')->required();\n $form->text('stocksnum');\n $form->text('tel');\n// $form->text('status');\n $form->radio('status')->options([ 1 => '不通过',2=>'通过',3=>'已过期',4=>'已完成'])->help('不通过状态不显示')->required();\n\n $form->display('created_at');\n $form->display('updated_at');\n });\n }", "public function create()\n {\n return view(\"admin.athletes.create\",compact('athlete'));\n }", "public function newAction()\n {\n if(!$this->get('security.context')->isGranted('ROLE_ADMIN')){\n throw new AccessDeniedException('Accès limité aux administrateurs!');\n }\n\n $entity = new Associate();\n $form = $this->createCreateForm($entity);\n\n return $this->render('MPTimeSheetBundle:Associate:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function actionCreate()\n {\n $model = new Apartment();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('update', [\n 'model' => $model,\n ]);\n }\n }", "public function create()\n\t{\n\t\treturn view('Agency::add');\n\t}", "public function newAction()\n {\n $t = $this->getTranslation();\n $this->view->setVar(\"t\", $t);\n\n $form = new StationsForm(new Stations());\n $this->view->setVar('form', $form);\n }", "public function create()\n {\n return view('instructor.create');\n }", "public function create()\n {\n return view('admin.expert.create');\n }", "public function create()\n {\n //Form in views\\forms\\add-teacher\n }", "public function adminCreate()\n {\n $configuration ['route'] =\"app.airlines.create\";\n $configuration ['title'] = \"New Airline record\";\n\n return view('admin.adminFormAirlines', $configuration);\n }", "public function create(){\n\n \treturn view('administrador.assunto.createAssunto')->with('disciplinas', Disciplina_ht::all());\n }", "public function create()\n {\n Return View::make(\"facilities.add\");\n }", "public function create()\n {\n return view('formularios.instructor');\n }", "public function create()\n {\n return view('exam.create');\n }", "public function create()\n {\n return view('backend.examtype.create');\n }", "public function showForm()\n {\n return view('backend.employee.new');\n\n }", "public function create()\n\t{\n\t\treturn view('aircraft.create');\n\t}", "public function create()\n {\n return view('student::guardians.create',\n ['title'=>trans('student::local.new_guardian')]);\n }", "public function create()\n {\n return view('admin.introduce.add');\n }", "public function create()\n {\n return view ('appliance.create');\n }", "public function create()\n {\n return view('admin.facilities.create');\n }", "public function create()\n {\n $facilities = Facility::all();\n $user_id = Auth::id();\n $data = [\n 'facilities' => $facilities,\n 'user_id' => $user_id,\n ];\n return view('admin.apartments.create', $data);\n\n }", "public function create()\n {\n return view('admission.create');\n }", "public function create()\n {\n //\n return view('back.attestations.create');\n }", "public function create()\n {\n // load the create form\n return View::make('algos.create');\n }", "public function create()\n {\n return view(\"Student/addform\");\n //\n }", "public function create()\n {\n return view('exam.create');\n\n }", "public function create() {\n $viewData = $this->getDefaultFormViewData();\n $viewData[\"mode\"] = \"create\";\n $viewData[\"supplier\"] = new Supplier();\n\n $viewData[\"supplier\"]->supplier_number = NumberSeries::getNextNumber(Supplier::MODULE_CODE);\n\n return view(\"{$this->viewPath}.form\", $viewData);\n }" ]
[ "0.6789768", "0.6700501", "0.66912544", "0.6656736", "0.6640778", "0.66397303", "0.6607372", "0.6605654", "0.659037", "0.658142", "0.6579949", "0.6555188", "0.65419304", "0.6540528", "0.6528261", "0.65146625", "0.6507538", "0.64960825", "0.6492419", "0.64855397", "0.6479298", "0.6473952", "0.6467502", "0.6461355", "0.64593416", "0.6458722", "0.6450173", "0.6449727", "0.64493114", "0.6441591" ]
0.762605
0
Store a newly created Assistance in storage.
public function store(CreateAssistanceRequest $request) { $input = $request->all(); $assistance = Assistance::create($input); Flash::message('Costo de Servicio de Asistencia guardado con éxito.'); return redirect(route('assistances.index')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store(CreateAssistanceRequest $request)\n {\n $input = $request->all();\n\n $assistance = $this->assistanceRepository->create($input);\n\n Flash::success('Assistance saved successfully.');\n\n return redirect(route('assistances.index'));\n }", "public function store()\n {\n $this->storage->set($this);\n\n }", "public function store(Request $request)\n {\n $assistance = new Assistance($request->all());\n $assistance->save();\n\n Flash::success(\"Se ha registrado de forma exitosa! \");\n \n return redirect()->route('admin.assistances.index');\n }", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\n\t{\n\t\t// \n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}" ]
[ "0.70497483", "0.6534049", "0.62441117", "0.61986995", "0.61305827", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738", "0.612738" ]
0.711522
0
Formats a cell with a licence link based on licNo
public function formatCellLicNo($row, $showAsText = false) { if ($showAsText) { return Escape::html($row['licNo']); } return sprintf( '<a class="govuk-link" href="%s">%s</a>', $this->urlHelper->fromRoute('licence-no', ['licNo' => trim($row['licNo'])]), Escape::html($row['licNo']) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function costs_link($row)\n{\t\t\t\n\treturn $row[\"closed\"] || !$row[\"released\"] ? '' :\n\t\tpager_link(_('Costs'),\n\t\t\t\"/manufacturing/work_order_costs.php?trans_no=\" .$row[\"id\"]);\n}", "function lien($row){\n\treturn '<a href=\"' . $row[0] .'\"'. ((substr($row[0],0,4)==\"http\")?' target=\"_blank\" ':'') .'>'. $row[1] .'</a> '. $row[2];\n}", "private static function format_cell($cell) {\n return str_replace(\"\\n\", \"<br />\", str_replace(' ', '&nbsp;', s($cell)));\n }", "function view_gl_link($row)\n{\n\t//\treturn '';\n\treturn get_gl_view_str(ST_WORKORDER, $row['id']);\n}", "function format_table_cell($val,$data,&$align,&$comment,&$class) {\n\t$dval = array_key_exists($val,$data) ? str_replace(\"\\r\",\"\",$data[$val]) : \"\";\n\tif ((!empty($dval)) and (preg_match(\"/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/\", $dval, $regs))) {\n\t\t$output = date(\"d M Y\",strtotime($dval)); /* DD Mmm YYYY */\n\t\t$comment = substr($dval,11,10);\n\t} else if ((!empty($dval)) and (preg_match(\"/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{3})Z/\", $dval, $regs))) {\n\t\t$output = sprintf(\"%s/%s %s:%s\",$regs[3],$regs[2],$regs[4],$regs[5],$regs[6]);\n\t} else if ((!empty($dval)) and (preg_match(\"/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/\", $dval, $regs))) {\n\t if (date(\"Y-m-d\") == substr($dval,0,10)) {\n\t\t// Date Field (Today)\n \t\t$output = substr($dval,11,10);\n\t } else {\n\t\t// Date Field (Not Today)\n\t\tswitch ($val) {\n\t\t\tcase \"EventTime\":\n\t\t\tcase \"Updated\":\n\t\t\tcase \"allocated\":\n\t\t\tcase \"AcctStartTime\":\n\t\t\t\t$output = sprintf(\"%s/%s %s:%s\",$regs[3],$regs[2],$regs[4],$regs[5],$regs[6]);\n\t\t\t\tbreak;\n\t\t\tcase \"released\":\n\t\t\tcase \"AcctStopTime\":\n\t\t\t\t$output = substr($dval,11,5);\n\t\t\t\tbreak;\n \t\t\tdefault: \n\t\t\t\t// $output = substr($dval,0,10); /* YYYY-MM-DD */\n\t\t\t\t$output = date(\"d M Y\",strtotime($dval)); /* DD Mmm YYYY */\n\t\t\t\t$comment = substr($dval,11,10);\n\t\t}\n\t }\n\t $this->total[$val]=0;\n\t} else if ((!empty($dval)) and (preg_match(\"/([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}/\",$dval, $regs))) {\n\t\t// IPv4 Address\n\t\t$align=\"center\";\n\t\t$output = $dval;\n\t} else if ((isset($dval)) and ($dval<>\".\") and ($dval<>\",\") and (preg_match(\"/(^[$|-]*[0-9|,|.]+$)/\",$dval, $regs))) {\n\t\t// Numeric Field\n\t\tif (!isset($this->total[$val])) $this->total[$val]=0;\n\t\t$number = str_replace(\",\",\"\",str_replace(\"$\",\"\",$dval));\n\t\t$this->total[$val] += $number;\n\t\tswitch ($val) {\n\t\t\tcase \"AcctSessionTime\":\n\t\t\t\t$align = \"right\";\n\t\t\t\t$output=TimeStr($dval);\n\t\t\t\tbreak;\n\t\t\tcase \"AcctOutputOctets\":\n\t\t\tcase \"AcctInputOctets\":\n\t\t\t\t$output=ByteStr($dval);\n\t\t\t\tbreak;\n \t\t\tdefault: \n\t\t\t\t$align=\"right\";\n\t\t\t\tif (array_key_exists($val,$this->format)) {\n\t\t\t\t\tif ($fmat=$this->format[$val]) $output = money_fmat($fmat,$number);\n\t\t\t\t\telse $output=$dval;\n\t\t\t\t} else {\t\n\t\t\t\t\tif (strpos($number,\".\")) $output = number_format($number,2);\n\t\t\t\t\telse switch($val) {\n\t\t\t\t\t\tcase \"MerchantID\":\n\t\t\t\t\t\tcase \"Mobile\":\n\t\t\t\t\t\tcase \"WorkPhone\":\n\t\t\t\t\t\tcase \"HomePhone\":\n\t\t\t\t\t\tcase \"Fax\":\n\t\t\t\t\t\tcase \"PostCode\":\t// don't format these columns\n\t\t\t\t\t\t\t$output=$dval;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t$output = number_format(floatval($number));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$vval = \" $val\";\n\t\t\t\tif (strpos($vval,\"time\") or strpos($vval,\"date\")) $comment = @date(\"Y-m-d H:i:s\",$number);\n\t\t}\n\t} else { \n\t\t// Normal Field\n\t\t$output = $dval;\n\t}\n\n\t$output = str_replace(\"(TEST TRANSACTION ONLY)\",\"<b>(TEST)</b>\",$output);\n\n\treturn $output;\n }", "function render_cell($column, $survey_publication)\n {\n $content_object = $survey_publication->get_publication_object();\n \n switch ($column->get_name())\n {\n \n case ContentObject :: PROPERTY_TITLE :\n $content_object = $survey_publication->get_publication_object();\n $title = $content_object->get_title();\n return $title;\n case ContentObject :: PROPERTY_DESCRIPTION :\n $description = Utilities :: truncate_string($content_object->get_description(), 200);\n return $description;\n case SurveyPublication :: PROPERTY_FROM_DATE :\n return $this->get_date($survey_publication->get_from_date());\n case SurveyPublication :: PROPERTY_TO_DATE :\n return $this->get_date($survey_publication->get_to_date());\n default :\n return '&nbsp;';\n }\n }", "Function createhyperlink($sheet=\"Hoja1\",$cell,$hyperl)\n{\nprint \"<br>link = $hyperl <br>\";\n$sheets = $this->ex->Application->Worksheets($sheet);\n$sheets->activate;\n#Select the cell\n$selcell = $sheets->Range($cell);\n$sheets->hyperlinks->add($selcell,$hyperl);\n\nreturn 1;\n}", "protected function generateCell() {\n return \"\";\n }", "function format_phone_link($phone) {\n if(!isset($phone{3})) { return ''; }\n // note: strip out everything but numbers \n $phone = preg_replace(\"/[^0-9]/\", \"\", $phone);\n $length = strlen($phone);\n switch($length) {\n case 7:\n return preg_replace(\"/([0-9]{3})([0-9]{4})/\", \"$1-$2\", $phone);\n break;\n case 10:\n return preg_replace(\"/([0-9]{3})([0-9]{3})([0-9]{4})/\", \"$1-$2-$3\", $phone);\n break;\n case 11:\n return preg_replace(\"/([0-9]{1})([0-9]{3})([0-9]{3})([0-9]{4})/\", \"$1-$2-$3-$4\", $phone);\n break;\n default:\n return $phone;\n break;\n }\n}", "public function make_row_link()\n {\n return '#';\n }", "public function make_row_link()\n {\n return '#';\n }", "public static function format($data, $column = array(), $sm = null)\n {\n if (!empty($data['pi']['case']['licence']['organisation'])) {\n // display org linked to the licence\n return OrganisationLink::format($data['pi']['case']['licence'], $column, $sm);\n } elseif (!empty($data['pi']['case']['transportManager']['homeCd']['person'])) {\n // display TM details\n return Name::format($data['pi']['case']['transportManager']['homeCd']['person']);\n }\n return '';\n }", "function format_cc_number($cc_no){\n\tif($cc_no =='') return '';\n\treturn '**** **** **** ' . substr($cc_no,-4,4);\n}", "function doplnekLicence($licence, $zbyva_dni, $termin)\n{\n\tif($licence != \"placena\")\n\t\treturn;\n\tif($zbyva_dni > 0 && $zbyva_dni <= 10)\n\t\treturn \" <span class=\\\"attention\\\">(\".txt(\"dashboard-description_konci-za\").\" \".sklonuj(\"den\",$zbyva_dni).\")\";\n\tif($zbyva_dni > 0)\n\t\treturn \" (\".txt(\"dashboard-description_konci-za\").\" \".sklonuj(\"den\",$zbyva_dni).\")\";\n\tif($zbyva_dni <= 0 && $termin)\n\t\treturn \" (\".txt(\"dashboard-description_skoncila\").\")\";\n}", "public function get_licence()\n {\n return 'Licensed on the same terms as Composr';\n }", "public function get_licence()\n {\n return 'Licensed on the same terms as Composr';\n }", "public function get_licence()\n {\n return 'Licensed on the same terms as Composr';\n }", "function edit_entries_additional_celldata($row)\n\t{\t\n\t\tglobal $DSP, $LANG, $EXT, $DB, $LOC, $TMPL, $exp_i;\n\t\t\n\t\t\n\t\tif (empty($exp_i)){ $exp_i = 0; }\n\n\t\t$extra = ($EXT->last_call !== FALSE) ? $EXT->last_call : '';\n\t\t\n\t\tif( $this->settings['enable'] == 'n')\n\t\t{\n\t\t\treturn $extra;\n\t\t}\n\t\t\n\t\t\n\t\t\n $ret = \"\";\n $timestamp = $LOC->now;\n $query = $DB->query(\"SELECT expiration_date AS expd FROM exp_weblog_titles t WHERE entry_id='\".$row['entry_id'].\"'\");\n\t\t\n\t\tforeach($query->result as $item)\n\t {\n if ( ($item['expd'] != 0) && ($item['expd'] < $timestamp) )\n\t {\n $ret .= '<span class=\"lightLinks\" style=\"color:#ccc;\">Expired:<br />'.$LOC->set_human_time($item['expd']).'</span>';\n\t } elseif ( ($item['expd'] != 0) && ($item['expd'] > $timestamp) ) {\n $ret .= '<span class=\"lightLinks\" style=\"color:#999;\">Will Expire:<br />'.$LOC->set_human_time($item['expd']).'</span>';\n } else {\n $ret .= \"&nbsp;\";\n\t }\n\t }\n\t\t\t\t\t\t\t\t\t\t\n\t\t$style = ($exp_i % 2) ? 'tableCellOne' : 'tableCellTwo'; $exp_i++;\n\n\t\treturn $extra.$DSP->table_qcell($style, $ret);\n\n\t\t\n\t}", "public function getLabel ($row) {\n\t\treturn $row['owner_name'] . ':' . $row['ac_number'] . ':' . $row['bic'];\n\t}", "public static function format($data, array $column = [], ServiceLocatorInterface $sm = null)\n {\n return isset($data['irhpPermitApplication']['relatedApplication']) ? sprintf(\n '<a href=\"%s\">%s</a>',\n $sm->get('Helper\\Url')->fromRoute(\n 'licence/irhp-application',\n [\n 'action' => 'index',\n 'licence' => $data['irhpPermitApplication']['relatedApplication']['licence']['id']\n ]\n ),\n Escape::html($data['irhpPermitApplication']['relatedApplication']['applicationRef'])\n ) : '';\n }", "function print_document_link($doc_no, $link_text, $link=true, $type_no, \n\t$icon=false, $class='printlink', $id='', $email=0, $extra=0)\n{\n\tglobal $path_to_root;\n\tinclude_once($path_to_root . \"/includes/types.inc\");\n\tinclude_once($path_to_root . \"/simplex/includes/db/email_jobs.inc\");\n\n\t$url = $path_to_root.'/reporting/prn_redirect.php?';\n\n\tswitch ($type_no)\n\t{\n\t\tcase ST_SALESQUOTE :\n\t\t\t$rep = 111;\n\t\t\t// from, to, currency, bank acc, email, quote, comments\n\t\t\t$ar = array(\n\t\t\t\t'PARAM_0' => $doc_no, \n\t\t\t\t'PARAM_1' => $doc_no, \n\t\t\t\t'PARAM_2' => '', \n\t\t\t\t'PARAM_3' => $email, \n\t\t\t\t'PARAM_4' => '');\n\t\t\tbreak;\n\t\tcase ST_SALESORDER :\n\t\t\t$rep = 109;\n\t\t\t// from, to, currency, bank acc, email, quote, comments\n\t\t\t$ar = array(\n\t\t\t\t'PARAM_0' => $doc_no, \n\t\t\t\t'PARAM_1' => $doc_no, \n\t\t\t\t'PARAM_2' => '', \n\t\t\t\t'PARAM_3' => $email, \n\t\t\t\t'PARAM_4' => 0, \n\t\t\t\t'PARAM_5' => '');\n\t\t\tbreak;\n\t\tcase ST_CUSTDELIVERY :\n\t\t\t$rep = 110;\n\t\t\t// from, to, email, comments\n\t\t\t$ar = array(\n\t\t\t\t'PARAM_0' => $doc_no, \n\t\t\t\t'PARAM_1' => $doc_no, \n\t\t\t\t'PARAM_2' => $email,\n\t\t\t\t'PARAM_3' => $extra);\n\t\t\tbreak;\n\t\tcase ST_SALESINVOICE : // Sales Invoice\n\t\tcase ST_CUSTCREDIT : // Customer Credit Note\n\t\t\t$rep = 107;\n\t\t\t// from, to, currency, bank acc, email, paylink, comments, type\n\t\t\t$ar = array(\n\t\t\t\t'PARAM_0' => $doc_no, \n\t\t\t\t'PARAM_1' => $doc_no, \n\t\t\t\t'PARAM_2' => '', \n\t\t\t\t'PARAM_3' => $email, \n\t\t\t\t'PARAM_4' => '',\n\t\t\t\t'PARAM_5' => '', \n\t\t\t\t'PARAM_6' => $type_no);\n\t\t\tbreak;\n\t\tcase ST_PURCHORDER :\n\t\tcase ST_PURCHREQ : \n\t\t\t$rep = 209;\n\t\t\t// from, to, currency, bank acc, email, comments\n\t\t\t$ar = array(\n\t\t\t\t'PARAM_0' => $doc_no, \n\t\t\t\t'PARAM_1' => $doc_no, \n\t\t\t\t'PARAM_2' => '', \n\t\t\t\t'PARAM_3' => $email, \n\t\t\t\t'PARAM_4' => '');\n\t\t\tbreak;\n\t\tcase ST_CUSTPAYMENT :\n\t\t\t$rep = 112;\n\t\t\t// from, to, currency, bank acc, email, comments\n\t\t\t$ar = array(\n\t\t\t\t'PARAM_0' => $doc_no, \n\t\t\t\t'PARAM_1' => $doc_no, \n\t\t\t\t'PARAM_2' => '', \n\t\t\t\t'PARAM_4' => '');\n\t\t\tbreak;\n\t\tcase ST_SUPPAYMENT :\n\t\t\t$rep = 210;\n\t\t\t// from, to, currency, bank acc, email, comments\n\t\t\t$ar = array(\n\t\t\t\t'PARAM_0' => $doc_no, \n\t\t\t\t'PARAM_1' => $doc_no, \n\t\t\t\t'PARAM_2' => '', \n\t\t\t\t'PARAM_3' => $email, \n\t\t\t\t'PARAM_4' => '');\n\t\t\tbreak;\n//\t\tdefault: $ar = array();\n\t}\n\t$url_2 = print_link_urlonly($link_text, $rep, $ar, \"\", $icon, $class, $id);\n\t//echo '3mail =' . $email;\n\tif($email <> 0)\n\t{\n\t\t\n\t\t//$sender = \"ET\";\n\t\t//$recipient =\"ET\";\n\t\t//$status='L';\n\t\t////add_email_job($sender,$recipient,'','','',$status,$url_2);\n\t\t//\t\t\t\t$sql = \"INSERT INTO \".TB_PREF.\"epin_email_jobs\"\n\t\t//. \" (id,email_sender,email_recipient,email_bcc,email_cc,email_attachment,status,logged_date,url)\n\t\t//\tVALUES( EPIN_EMAIL_JOBS_ID_SEQ.nextval,\" \n\t\t//\t.\tdb_escape($sender)\t.\", \"\n\t\t//\t.db_escape($recipient)\t.\", \"\n\t\t//\t.\tdb_escape($bcc)\t.\", \"\n\t\t//\t.db_escape($cc)\t.\", \"\n\t\t//\t. db_escape($attach). \",\"\n\t\t//\t.db_escape($status)\t.\", SYSDATE, \"\n\t\t//\t. db_escape($url_2) .\")\";\n\t\t//\t//echo $sql;\n\t\t//db_query($sql, \"Cannot log email job info\");\n\t\n\t}\n\t//echo 'url=' . $url;\n\treturn print_link($link_text, $rep, $ar, \"\", $icon, $class, $id);;\n}", "function show_cell($which) {\n $token = $this->position[$which];\n //deal with the easy case\n if($token <> '-') {\n return '<td>' . $token . '</td>';\n }\n //now the hard one\n $this->newposition = $this->position; // copy the original\n $this->newposition[$which] = 'x'; // this would be their move\n $move = implode($this->newposition); // make a string from the board array\n $link = '/COMP4711?board=' . $move; // this is what we want the link to be\n // so return a cell containing an anchor and showing a hyphen\n return '<td><a class=\"cell\" href=\"' . $link . '\">-</a></td>';\n }", "function areaWriteHTMLCell($pdf,$area,$text,$border=0, $ln=0, $fill=false, $reseth=true, $align='', $autopad=false)\n{\n// $pdf->setCellMargins(0,0,0,0);\n\n return($pdf->writeHTMLCell(\n\t\t $area[\"w\"],$area[\"h\"],$area[\"x\"],$area[\"y\"],\n\t\t $text,\n\t\t $border, $ln, $fill, $reseth, $align, $autopad));\n}", "function partial_info_bn($row, $value, $t) {\n $prefix = $row['prefix'];\n $heading = $row['heading'];\n $text = $row['text'];\n $out = <<<\"END\"\n<table style=\"width:100%;\"><tr>\n<td style=\"font-size:14px;padding: 2px 4px;\">\n <div style=\"vertical-align:top;\"><b>{$heading}</b> {$text}</div>\n</td>\n</tr></table>\nEND;\n\n return $out;\n }", "function csv_format_os_build( $p_os_build ) {\r\n\t\treturn csv_escape_string( $p_os_build );\r\n\t}", "function edit_entries_additional_celldata($row)\n\t{\t\n\t\tglobal $DSP, $LANG, $EXT, $DB;\n\t\t\n\t\tglobal $img_i;\n\t\t \n\t\t if (empty($img_i))\n\t\t {\n\t\t \t$img_i = 0;\n\t\t }\n\t\t\n\t\tif (empty($this->settings['field_id'])) {\n\t\t return;\n\t\t}\n\t\t\n\t\t$image=\"-\";\n\t\t\n\t\t$uploadprefs = $DB->query('SELECT f.*, u.url as theurl FROM exp_weblog_fields f, exp_upload_prefs u WHERE f.field_id = '.$this->settings['field_id'].' AND f.field_list_items=u.id');\n\t\t\n\t\t$customfield = 'field_id_'.$this->settings['field_id'];\n\t\t\n\t\t$query = $DB->query(\"SELECT \".$customfield.\" FROM exp_weblog_data WHERE entry_id='\".$row['entry_id'].\"'\");\n\t\t\n\t\t$theimage = \"\";\n\t\t$thefileuploadpath = \"\";\n\n\t\t\tforeach($uploadprefs->result as $uploadpref)\n\t\t{\n\t\t $thefileuploadpath = $uploadpref['theurl'];\n\t }\n\n\t\t\tforeach($query->result as $file_field)\n\t\t{\n\t\t $theimage = $file_field[$customfield];\n\t }\n\tif ($theimage !=\"\") {\n\t\t $image = '<img src=\"'.$thefileuploadpath.$theimage.'\" alt=\"\" width=\"'.$this->settings['thumb_width'].'\" valign=\"middle\" />';\n\t\t} \n\t\t\t\t\t\t\t\n\t\t$style = ($img_i % 2) ? 'tableCellOne' : 'tableCellTwo'; $img_i++;\n\t\t\n\t\t$extra = ($EXT->last_call !== FALSE) ? $EXT->last_call : '';\n\t\t\n\t\treturn $extra.$DSP->table_qcell($style, $image);\n\t}", "function write_cell ($type, $text, $attribute='')\n{\n printf (\" <%s %s>%s</%s>\\n\",\n\t $type, $attribute,\n\t $text,\n\t $type);\n}", "function render_cell($column, $webconference)\r\n {\r\n switch ($column->get_name())\r\n {\r\n case Webconference :: PROPERTY_ID :\r\n return $webconference->get_id();\r\n case Webconference :: PROPERTY_CONFNAME :\r\n return $webconference->get_confname();\r\n case Webconference :: PROPERTY_DESCRIPTION :\r\n return $webconference->get_description();\r\n case Webconference :: PROPERTY_DURATION :\r\n return $webconference->get_duration();\r\n default :\r\n return '&nbsp;';\r\n }\r\n }", "function formatCoeusRow($row, $instance) {\n\t$rowData = json_decode($row['DATA'], true);\n\t$rowData['redcap_repeat_instance'] = $instance;\n\t$rowData['redcap_repeat_instrument'] = \"coeus\";\n\t$rowData['coeus_complete'] = \"2\";\n\treturn $rowData;\n}", "function writeQuoteBankinfo($extrainfo) {\n if (!empty($extrainfo)) {\n $lines = explode(\"\\n\", $extrainfo);\n foreach ($lines as $line) {\n $this->row++;\n $this->phpExcel->getActiveSheet()->mergeCells('B' . $this->row . ':I' . $this->row);\n//$this->phpExcel->getActiveSheet()->getStyle('B' . $this->row)->getAlignment()->setWrapText(true);\n $this->phpExcel->getActiveSheet()->getRowDimension($this->row)->setRowHeight(-1);\n//$this->rnext();\n $linep = explode(\"Acc:\", $line);\n if (count($linep) >= 2) {\n $this->phpExcel->getActiveSheet()->setCellValue('B' . $this->row, $linep[0]);\n $this->phpExcel->getActiveSheet()->getStyle('B' . $this->row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);\n $this->rnext();\n $this->phpExcel->getActiveSheet()->setCellValue('B' . $this->row, ' Acc:' . $linep[1]);\n $this->phpExcel->getActiveSheet()->getStyle('B' . $this->row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);\n }\n }\n }\n }" ]
[ "0.5797913", "0.56478554", "0.5416318", "0.5396308", "0.5358785", "0.5355161", "0.51546395", "0.51072246", "0.50935805", "0.5054631", "0.5054631", "0.50298226", "0.50239605", "0.5011413", "0.50068665", "0.50068665", "0.50068665", "0.5003755", "0.49859378", "0.49780205", "0.49733016", "0.49616912", "0.49313045", "0.49015972", "0.48912403", "0.48781526", "0.48758194", "0.48672116", "0.48555288", "0.4852913" ]
0.708441
0
Include Foundation CSS/SCSS components
function fett_foundation_add_css(){ global $theme_key; $sonar_enabled = module_exists('sonar'); $scss = theme_get_setting('fett_foundation_scss'); $options = array( 'every_page' => TRUE, 'weight' => -1000 ); drupal_add_css(); if(@is_array($scss) && $sonar_enabled){ $fett_path = drupal_get_path('theme', 'fett'); $current_path = drupal_get_path('theme', $theme_key); $path = $fett_path . '/assets/foundation/scss'; $override = $current_path . '/assets/scss/override'; // Add normalize no matter what drupal_add_css($path . '/normalize.scss', $options); if(theme_get_setting('fett_foundation_settings')){ // Add custom Foundation SCSS settings file. drupal_add_css($fett_path . '/assets/foundation/scss/foundation/_functions.scss', $options); drupal_add_css($current_path . '/assets/scss/libraries/_settings.scss', $options); } $path .= '/foundation/components'; foreach($scss as $s){ if(empty($s)) continue; $use_path = $path; // Allow local overriding of Foundation files if(file_exists($override.'/_'.$s.'.scss')){ $use_path = $override; } drupal_add_css($use_path.'/_'.$s.'.scss', $options); } // Add theme css no matter what drupal_add_css($fett_path . '/assets/scss/theme.scss', $options); } // We have not selected any SCSS components to include OR Sonar is not // enabled. In this case we just use default compiled Foundation. else{ $path = drupal_get_path('theme', 'fett').'/assets/foundation/css'; // Add normalize no matter what drupal_add_css($path . '/normalize.css', $options); drupal_add_css($path . '/foundation.min.css', $options); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function __construct() {\n\t\t//-- inlines sass in <head> \n\t\t\n\t\t \n\t\t\n\t\t\n\t\t\n\t ///--------------------------------------//\t\n \t\n }", "function enqueue_foundation() {\n\t// wp_enqueue_style( 'foundation', get_template_directory_uri() . '/css/foundation.min.css' );\n\n\twp_enqueue_style( 'compressed', get_template_directory_uri() . '/css/compressed.css' );\n}", "function fett_foundation_get_scss($options = FALSE) {\n $file = file_get_contents(dirname(dirname(__FILE__)) . '/assets/foundation/scss/foundation.scss');\n preg_match_all(\"/components\\/(.*)?\\\"/\",$file,$matches, PREG_PATTERN_ORDER);\n $names = array();\n if(!empty($matches[1]) && is_array($matches[1])){\n foreach($matches[1] as $match){\n $names[$match] = ucwords(str_replace('-',' ',$match));\n }\n }\n return $names;\n}", "function mailchimpSF_main_css() {\n require_once(MCSF_DIR . '/views/css/frontend.php');\n}", "public function addCSS()\n {\n // $this->addToVar('cssCode', $this->addResource('/twbs/bootstrap/dist/css/bootstrap.min', 'css'));\n // $this->addToVar('cssCode', $this->addResource('/css/alxarafe', 'css'));\n }", "public static function add_css() {\n\t/// css code aici\n\t}", "function shariff3uu_amp_css() {\n\t// Get options.\n\t$shariff3uu = $GLOBALS['shariff3uu'];\n\t// Output CSS.\n\tob_start();\n\tinclude dirname( __FILE__ ) . '/css/shariff.min.css';\n\t$shariff_css = ob_get_clean();\n\tif ( false !== $shariff_css ) {\n\t\techo esc_html( str_replace( '!important', '', $shariff_css ) );\n\t} else {\n\t\tinclude dirname( __FILE__ ) . '/css/shariff.min.css';\n\t}\n\tif ( array_key_exists( 'dynamic_css', $shariff3uu ) && ! empty( $shariff3uu['dynamic_css'] ) ) {\n\t\techo esc_html( $shariff3uu['dynamic_css'] );\n\t}\n}", "public function composer_additional_styles() {}", "protected function includeAccordionFiles()\n {\n $this->pageRenderer->addCssFile(\n $this->resourcePath . 'CSS/t3ddy-accordion.css',\n 'stylesheet',\n 'all',\n '',\n false,\n false,\n '',\n false\n );\n\n }", "function beans_enqueue_uikit_components() {\n\n\t$core = array(\n\t\t'base',\n\t\t'block',\n\t\t'grid',\n\t\t'article',\n\t\t'comment',\n\t\t'panel',\n\t\t'nav',\n\t\t'navbar',\n\t\t'subnav',\n\t\t'table',\n\t\t'breadcrumb',\n\t\t'pagination',\n\t\t'list',\n\t\t'form',\n\t\t'button',\n\t\t'badge',\n\t\t'alert',\n\t\t'dropdown',\n\t\t'offcanvas',\n\t\t'text',\n\t\t'utility',\n\t\t'icon'\n\t);\n\n\tbeans_uikit_enqueue_components( $core );\n\n\t// Include uikit default theme.\n\tbeans_uikit_enqueue_theme( 'default' );\n\n\t// Enqueue uikit overwrite theme folder.\n\tbeans_uikit_enqueue_theme( 'beans', BEANS_ASSETS_URL . 'less/uikit-overwrite' );\n\n\t// Add the theme style as a uikit fragment to have access to all the variables.\n\tbeans_compiler_add_fragment( 'uikit', BEANS_ASSETS_URL . 'less/style.less', 'less' );\n\n\t// Add the theme default style as a uikit fragment only if the theme supports it.\n\tif ( current_theme_supports( 'beans-default-styling' ) )\n\t\tbeans_compiler_add_fragment( 'uikit', BEANS_ASSETS_URL . 'less/default.less', 'less' );\n\n}", "function template_css()\n{\n\ttheme()->template_css();\n}", "function phorum_mod_announcements_css_register($data)\n{\n $data['register'][] = array(\n \"module\" => \"announcements\",\n \"where\" => \"after\",\n \"source\" => \"template(announcements::css)\"\n );\n return $data;\n}", "function addCSSFiles()\n\t{\n\t\t$this->AddCSSFile(\"include/zoombox/zoombox.css\");\n\t}", "public function add_css() {\n\t\twp_register_style( 'font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css' );\n\t\twp_register_style( 'wp-to-top', plugins_url( 'wp-to-top/css/wp-to-top.css' ) );\n\n\t\twp_enqueue_style( 'font-awesome' );\n\t\twp_enqueue_style( 'wp-to-top' );\n\n\t\t// custom css from the settings\n\t\trequire_once ( dirname( __DIR__ ) . '/views/css.php' );\n\t\twp_add_inline_style( 'wp-to-top', $custom_css );\n\t}", "function includeCss($path) {\n echo '<link rel=\"stylesheet\" href=\"' . $this->getUrl($path) . '\">';\n }", "function ivan_vc_custom_css() {\n\tglobal $ivan_custom_css;\n\techo '<style>' . $ivan_custom_css . '</style>';\n}", "public function hookDisplayBackOfficeHeader()\n {\n $this->context->controller->addCss($this->_path.'views/css/style.css');\n }", "function compile_sass(){\n\t$paths\t= array(\n\t\tTEMPLATEPATH . '/stylesheets/sass/',\n\t\tTEMPLATEPATH . '/stylesheets/sass/base/',\n\t\tTEMPLATEPATH . '/stylesheets/sass/layouts/',\n\t\tTEMPLATEPATH . '/stylesheets/sass/sections/'\n\t);\n\n\t// Load and set compiler options\n\t$scss = new Compiler();\n\t$scss->setImportPaths( $paths );\n\n\t// Get styles\n\t$theme_styles = file_get_contents( TEMPLATEPATH . '/stylesheets/sass/style.scss' );\n\t$backend_styles = file_get_contents( TEMPLATEPATH . '/admin/backend-styles.scss' );\n\n\t// Compile styles\n\t$theme_formatted = $scss->compile( $theme_styles );\n\t$backend_formatted = $scss->compile( $backend_styles );\n\n\t// Write theme styles\n\tfile_put_contents( TEMPLATEPATH . '/stylesheets/style.css', $theme_formatted );\n\t// Write backend styles\n\tfile_put_contents( TEMPLATEPATH . '/admin/backend-styles.css', $backend_formatted );\n\n}", "public function insert_inline_css() {\n }", "public function insert_inline_css() {\n }", "public function insert_inline_css() {\n }", "public function insert_inline_css() {\n }", "public function insert_inline_css() {\n }", "function foucs_create_admin_custom_css() {\n require_once (get_template_directory() . '/inc/admin/templates/foucs-custom-css.php'); // Include Settings Admin Page\n}", "function rocket_insert_load_css() {\n\t_deprecated_function( __FUNCTION__, '2.11', 'Rocket_Critical_CSS->insert_load_css()' );\n}", "private function css(){\n $this->output = implode('', array_map('file_get_contents', $this->currentFiles)); \n //less\n if($this->config['less']==true){$this->lessToCss();}\n //compress CSS\n if($this->config['CSScompressor']==true){$this->compressCSS();} \n \n }", "protected function addCssFiles(): void\n {\n $this->design->addCss(\n PH7_LAYOUT,\n PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS . 'tabs.css,' . PH7_SYS . PH7_MOD . $this->registry->module . PH7_SH . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_CSS . 'general.css'\n );\n }", "function sc_evo_style(){\n\t\twp_enqueue_style( 'sc-evo-style', get_template_directory_uri() . '/assets/css/app.css' );\n}", "function section_styles(){\n\n /** Include the sample script */\n pl_script( $this->id, $this->base_url . '/scripts.js' );\n pl_script( $this->id, $this->base_url . '<script src=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js\"></script>' );\n pl_style( 'style-css', \t$this->base_url.'/style.css');\n \n \n}", "protected function showCSS () {\n\t\tforeach ($this->_css_files as $file) {\n\t\t\t$fullpath = Config::get('application.base_path') . \"/css/$file\";\n?><link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"<?php echo $fullpath ?>\" />\n<?php\n\t\t}\n\t}" ]
[ "0.6408789", "0.6374494", "0.6133188", "0.5915341", "0.5832016", "0.57420367", "0.5657815", "0.56267995", "0.5626395", "0.55832124", "0.5563265", "0.5557991", "0.55292845", "0.54976594", "0.5491119", "0.5488081", "0.54656285", "0.5460317", "0.5442778", "0.5442778", "0.5442778", "0.5442778", "0.5442778", "0.54283655", "0.5417383", "0.54145515", "0.5411953", "0.54051435", "0.5397697", "0.5386387" ]
0.7246028
0
Returns a list of Foundation SCSS components
function fett_foundation_get_scss($options = FALSE) { $file = file_get_contents(dirname(dirname(__FILE__)) . '/assets/foundation/scss/foundation.scss'); preg_match_all("/components\/(.*)?\"/",$file,$matches, PREG_PATTERN_ORDER); $names = array(); if(!empty($matches[1]) && is_array($matches[1])){ foreach($matches[1] as $match){ $names[$match] = ucwords(str_replace('-',' ',$match)); } } return $names; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function compileScssDataProvider(): array\n {\n return [\n [\n 'compact',\n <<<CSS\n nav ul { margin:0; }\n\n nav ul li { color:#111; }\n\n\nCSS\n ],\n [\n 'compressed',\n <<<CSS\nnav ul{margin:0}nav ul li{color:#111}\nCSS\n ],\n [\n 'crunched',\n <<<CSS\nnav ul{margin:0}nav ul li{color:#111}\nCSS\n ],\n [\n 'expanded',\n <<<CSS\nnav ul {\n margin: 0;\n}\nnav ul li {\n color: #111;\n}\n\nCSS\n ],\n [\n 'nested',\n <<<CSS\nnav ul {\n margin: 0; }\n nav ul li {\n color: #111; }\n\nCSS\n ],\n ];\n }", "public function getCss() {\n $arr = [];\n foreach ($this->css as $css) {\n if (preg_match(\"/^([a-z]+\\:)?\\/\\//i\", $css))\n $arr[] = $css;\n else\n $arr[] = fileUrl(\"library/\".$this->name.\"/\".$css);\n }\n return $arr;\n }", "public function getComponents();", "public function getComponents();", "public function listVueComponents()\n {\n return [];\n }", "public function getCss();", "public static function componentsProvider() : array\n {\n return [\n 'brands' => [Brands::class],\n 'duotone' => [Duotone::class],\n 'light' => [Light::class],\n 'regular' => [Regular::class],\n 'solid' => [Solid::class],\n 'thin' => [Thin::class],\n 'sharp-regular' => [SharpRegular::class],\n 'sharp-solid' => [SharpSolid::class],\n ];\n }", "public function allCss()\n {\n return $this->css;\n }", "public function getCssClasses(): array\n {\n return $this->cssClasses;\n }", "function getComponents()\n {\n return $this->getProperty('components'); \n }", "public function components() {\n // Users\n foreach (user_roles(TRUE) as $role) {\n $components['user-' . $role->id()] = '(user) ' . $role->label();\n }\n // Terms\n foreach (Vocabulary::loadMultiple() as $vocab) {\n $components['taxonomy_vocabulary-' . $vocab->id()] = '(term) ' . $vocab->name;\n }\n // Nodes\n foreach (node_type_get_names() as $node_type => $name) {\n $components['node-' . $node_type] = '(node) ' . $name;\n }\n return $components;\n }", "protected function _load_css()\n\t{\n\t\t$modules = $this->config->item('modules_allowed', 'fuel');\n\t\t\n\t\t$css = array();\n\t\tforeach($modules as $module)\n\t\t{\n\t\t\t// check if there is a css module assets file and load it so it will be ready when the page is ajaxed in\n\t\t\tif (file_exists(MODULES_PATH.$module.'/assets/css/'.$module.'.css'))\n\t\t\t{\n\t\t\t\t$css[] = array($module => $module);\n\t\t\t}\n\t\t}\n\t\tif ($this->config->item('xtra_css', 'fuel'))\n\t\t{\n\t\t\t$css[] = array('' => $this->config->item('xtra_css', 'fuel'));\n\t\t}\n\t\treturn $css;\n\t}", "public function getComponents()\n\t{\n\t\treturn $this->_components;\n\t}", "public function getComponents()\n {\n return $this->components;\n }", "public function getComponents(): array\n {\n $recipes = [];\n $result = [];\n foreach ($this->images as $image) {\n $result[] = $image;\n $result[] = $recipes[] = new RecipeComponent(\n $image->getUniqueName(),\n $image->getCanvasType(),\n $image->getMinLevel(),\n $image->getMaxLevel(),\n $image->getFullInstanceIdAsHex()\n );\n }\n\n $result[] = new SnippetComponent(\n $this->getNamespace(),\n $this->paintingStyle,\n $recipes\n );\n\n return $result;\n }", "public function get_styles()\n {\n return [];\n }", "public function getComponents(): array\n {\n return $this->components;\n }", "public function own_components() {\n\t\treturn array(\n\t\t\t'typography' => array(\n\t\t\t\t'config' => array(\n\t\t\t\t\t'FontColor' => array(\n\t\t\t\t\t\t'css_suffix' => ' span',\n\t\t\t\t\t),\n\t\t\t\t\t'LetterSpacing' => array(\n\t\t\t\t\t\t'css_suffix' => ' span',\n\t\t\t\t\t),\n\t\t\t\t\t'LineHeight' => array(\n\t\t\t\t\t\t'css_suffix' => ' span',\n\t\t\t\t\t),\n\t\t\t\t\t'FontSize' => array(\n\t\t\t\t\t\t'css_suffix' => ' span',\n\t\t\t\t\t),\n\t\t\t\t\t'TextStyle' => array(\n\t\t\t\t\t\t'css_suffix' => ' span',\n\t\t\t\t\t),\n\t\t\t\t\t'TextAlign' => array(\n\t\t\t\t\t\t'important' => true,\n\t\t\t\t\t),\n\t\t\t\t\t'TextTransform' => array(\n\t\t\t\t\t\t'css_suffix' => ' span',\n\t\t\t\t\t),\n\t\t\t\t\t'FontFace' => array(\n\t\t\t\t\t\t'css_suffix' => ' span',\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t\t'layout' => array(\n\t\t\t\t'hidden' => true,\n\t\t\t),\n\t\t\t'background' => array(\n\t\t\t\t'hidden' => true,\n\t\t\t),\n\t\t\t'borders' => array(\n\t\t\t\t'hidden' => true,\n\t\t\t),\n\t\t\t'shadow' => array(\n\t\t\t\t'hidden' => true,\n\t\t\t),\n\t\t\t'animation' => array(\n\t\t\t\t'hidden' => true,\n\t\t\t),\n\t\t\t'responsive' => array(\n\t\t\t\t'hidden' => true,\n\t\t\t),\n\t\t\t'styles-templates' => array(\n\t\t\t\t'hidden' => true,\n\t\t\t),\n\t\t);\n\t}", "abstract public function getCss();", "public function components()\n {\n return $this->getManifest();\n }", "public function getStyles(): Collection\n {\n return static::getConfigData('styles');\n }", "public function own_components() {\n\t\treturn array(\n\t\t\t'divider' => array(\n\t\t\t\t'config' => array(\n\t\t\t\t\t'divider_color' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'label' => __( 'Fill', 'thrive-cb' ),\n\t\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t\t'showGlobals' => false,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'ColorPicker',\n\t\t\t\t\t),\n\t\t\t\t\t'thickness' => array(\n\t\t\t\t\t\t'css_prefix' => apply_filters( 'tcb_divider_prefix', '' ),\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'default' => '5',\n\t\t\t\t\t\t\t'min' => '1',\n\t\t\t\t\t\t\t'max' => '100',\n\t\t\t\t\t\t\t'label' => __( 'Thickness', 'thrive-cb' ),\n\t\t\t\t\t\t\t'um' => array( 'px' ),\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'Slider',\n\t\t\t\t\t),\n\t\t\t\t\t'style' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'label' => __( 'Choose Divider Style', 'thrive-cb' ),\n\t\t\t\t\t\t\t'items' => array(\n\t\t\t\t\t\t\t\t'tve_sep-1' => array(\n\t\t\t\t\t\t\t\t\t'label' => __( 'Solid', 'thrive-cb' ),\n\t\t\t\t\t\t\t\t\t'background_image' => '',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t'tve_sep-2' => array(\n\t\t\t\t\t\t\t\t\t'label' => __( 'Dotted', 'thrive-cb' ),\n\t\t\t\t\t\t\t\t\t'background_image' => \"data:image/svg+xml;charset=utf8,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 9 3' style='enable-background:new 0 0 9 3;' xml:space='preserve'%3E%3Ccircle fill='%thrive%' cx='4.5' cy='1.5' r='1.5'/%3E%3C/svg%3E\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t'tve_sep-3' => array(\n\t\t\t\t\t\t\t\t\t'label' => __( 'Dashed Slim', 'thrive-cb' ),\n\t\t\t\t\t\t\t\t\t'background_image' => \"data:image/svg+xml;charset=utf8,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 9 3' style='enable-background:new 0 0 9 3;' xml:space='preserve'%3E%3Crect x='2' y='1' fill='%thrive%' width='5' height='1'/%3E%3C/svg%3E\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t'tve_sep-4' => array(\n\t\t\t\t\t\t\t\t\t'label' => __( 'Dashed Thick', 'thrive-cb' ),\n\t\t\t\t\t\t\t\t\t'background_image' => \"data:image/svg+xml;charset=utf8,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 9 3' style='enable-background:new 0 0 9 3;' xml:space='preserve'%3E%3Crect x='1' y='0.4' fill='%thrive%' width='7' height='2.3'/%3E%3C/svg%3E\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t'tve_sep-5' => array(\n\t\t\t\t\t\t\t\t\t'label' => __( 'Starred', 'thrive-cb' ),\n\t\t\t\t\t\t\t\t\t'background_image' => \"data:image/svg+xml;charset=utf8,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 50 50' enable-background='new 0 0 50 50' xml:space='preserve' preserveAspectRatio='none slice'%3E%3Cpath fill='%thrive%' d='M44.4 39.2l-15-3.4-11.3 10.4-1.4-15.3-13.3-7.5 14.1-6 3-15.1 10.1 11.6 15.2-1.8-7.8 13.2z'/%3E%3C/svg%3E\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t'default' => 'tve_sep1',\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t\t'typography' => array( 'hidden' => true ),\n\t\t\t'borders' => array( 'hidden' => true ),\n\t\t\t'animation' => array( 'hidden' => true ),\n\t\t\t'background' => array( 'hidden' => true ),\n\t\t\t'shadow' => array( 'hidden' => true ),\n\t\t\t'layout' => array(\n\t\t\t\t'disabled_controls' => array(\n\t\t\t\t\t'.tve-advanced-controls',\n\t\t\t\t\t'hr',\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t}", "function getStyles () {\r\n return array(\"css/forum.css\");\r\n }", "public static function getComponents()\n\t{\n\t\t// Initialise variable.\n\t\t$db = App::get('db');\n\t\t$query = $db->getQuery()\n\t\t\t->select('name', 'text')\n\t\t\t->select('element', 'value')\n\t\t\t->from('#__extensions')\n\t\t\t->where('enabled', '>=', '1')\n\t\t\t->whereEquals('type', 'component');\n\n\t\t$items = $db->setQuery($query->toString())->loadObjectList();\n\n\t\tif (count($items))\n\t\t{\n\t\t\t$lang = Lang::getRoot();\n\n\t\t\tforeach ($items as &$item)\n\t\t\t{\n\t\t\t\t// Load language\n\t\t\t\t$extension = $item->value;\n\t\t\t\t$source = Component::path($extension) . '/admin';\n\t\t\t\t$lang->load(\"$extension.sys\", PATH_APP, null, false, true) ||\n\t\t\t\t$lang->load(\"$extension.sys\", $source, null, false, true);\n\n\t\t\t\t// Translate component name\n\t\t\t\t$item->text = Lang::txt($item->text);\n\t\t\t}\n\n\t\t\t// Sort by component name\n\t\t\t\\Hubzero\\Utility\\Arr::sortObjects($items, 'text', 1, true, $lang->getLocale());\n\t\t}\n\n\t\treturn $items;\n\t}", "public function getCSSFiles() {\n\t\treturn array($this->lonely->configScript.'lonely.css');\n\t}", "public function getCSSFiles() {\n\t\treturn array();\n\t}", "public function getCss()\n\t{\n\t\treturn $this->_cssFiles;\n\t}", "public function getCss(){ }", "public function own_components() {\n\t\treturn array(\n\t\t\t'lp-text' => array(),\n\t\t\t'lp-text-typography' => array(\n\t\t\t\t'config' => array(\n\t\t\t\t\t'LinkStates' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'name' => __( 'States', 'thrive-cb' ),\n\t\t\t\t\t\t\t'buttons' => array(\n\t\t\t\t\t\t\t\tarray( 'value' => 'default', 'text' => 'Default', 'default' => true ),\n\t\t\t\t\t\t\t\tarray( 'value' => 'hover', 'text' => 'Hover' ),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\t'ToggleControls' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'buttons' => array(\n\t\t\t\t\t\t\t\tarray( 'value' => 'tcb-lp-text-font-size', 'text' => __( 'Font Size', 'thrive-cb' ), 'default' => true ),\n\t\t\t\t\t\t\t\tarray( 'value' => 'tcb-lp-text-line-height', 'text' => __( 'Line Height', 'thrive-cb' ) ),\n\t\t\t\t\t\t\t\tarray( 'value' => 'tcb-lp-text-letter-spacing', 'text' => __( 'Letter Spacing', 'thrive-cb' ) ),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'ButtonGroup',\n\t\t\t\t\t),\n\t\t\t\t\t'FontSize' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'default' => '16',\n\t\t\t\t\t\t\t'min' => '1',\n\t\t\t\t\t\t\t'max' => '100',\n\t\t\t\t\t\t\t'label' => '',\n\t\t\t\t\t\t\t'um' => array( 'px', 'em' ),\n\t\t\t\t\t\t\t'css' => 'fontSize',\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'Slider',\n\t\t\t\t\t),\n\t\t\t\t\t'LetterSpacing' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'default' => 'auto',\n\t\t\t\t\t\t\t'min' => '0',\n\t\t\t\t\t\t\t'max' => '100',\n\t\t\t\t\t\t\t'label' => '',\n\t\t\t\t\t\t\t'um' => array( 'px' ),\n\t\t\t\t\t\t\t'css' => 'letterSpacing',\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'Slider',\n\t\t\t\t\t),\n\t\t\t\t\t'FontColor' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'default' => '000',\n\t\t\t\t\t\t\t'icon' => true,\n\t\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t\t'output' => 'object',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'ColorPicker',\n\t\t\t\t\t),\n\t\t\t\t\t'TextAlign' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'buttons' => array(\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-align-left',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'left',\n\t\t\t\t\t\t\t\t\t'default' => true,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-align-center',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'center',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-align-right',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'right',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-align-justify',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'justify',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'ButtonGroup',\n\t\t\t\t\t),\n\t\t\t\t\t'TextStyle' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'checkbox' => true,\n\t\t\t\t\t\t\t'buttons' => array(\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-bold',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'bold',\n\t\t\t\t\t\t\t\t\t'data' => array( 'style' => 'font-weight', 'off' => 'normal' ),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-italic',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'italic',\n\t\t\t\t\t\t\t\t\t'data' => array( 'style' => 'font-style', 'off' => 'normal' ),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-underline',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'underline',\n\t\t\t\t\t\t\t\t\t'data' => array( 'style' => 'text-decoration' ),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-strikethrough-variant',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'line-through',\n\t\t\t\t\t\t\t\t\t'data' => array( 'style' => 'text-decoration' ),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'ButtonGroup',\n\t\t\t\t\t),\n\t\t\t\t\t'TextTransform' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'buttons' => array(\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'none',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'none',\n\t\t\t\t\t\t\t\t\t'default' => true,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-all-caps',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'uppercase',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-capital',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'capitalize',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'icon' => 'format-lowercase',\n\t\t\t\t\t\t\t\t\t'text' => '',\n\t\t\t\t\t\t\t\t\t'value' => 'lowercase',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'ButtonGroup',\n\t\t\t\t\t),\n\t\t\t\t\t'FontFace' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'template' => 'controls/font-manager',\n\t\t\t\t\t\t\t'tinymce' => false,\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'FontManager',\n\t\t\t\t\t),\n\t\t\t\t\t'LineHeight' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'default' => '16',\n\t\t\t\t\t\t\t'min' => '1',\n\t\t\t\t\t\t\t'max' => '100',\n\t\t\t\t\t\t\t'label' => '',\n\t\t\t\t\t\t\t'um' => array( 'px', 'em' ),\n\t\t\t\t\t\t\t'css' => 'lineHeight',\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'extends' => 'Slider',\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t\t'lp-text-layout' => array(\n\t\t\t\t'disabled_controls' => array(\n\t\t\t\t\t'MaxWidth',\n\t\t\t\t\t'hr',\n\t\t\t\t\t'Alignment',\n\t\t\t\t\t'.tve-advanced-controls',\n\t\t\t\t),\n\t\t\t\t'config' => array(),\n\t\t\t),\n\t\t\t'lp-text-background' => array(\n\t\t\t\t'config' => array(\n\t\t\t\t\t'ColorPicker' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'icon' => true,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\t'PreviewFilterList' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'sortable' => false,\n\t\t\t\t\t\t\t'extra_class' => 'tcb-preview-list-white',\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\t'PreviewList' => array(\n\t\t\t\t\t\t'config' => array(\n\t\t\t\t\t\t\t'sortable' => true,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\t'disabled_controls' => array(\n\t\t\t\t\t'video',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'lp-text-borders' => array(\n\t\t\t\t'config' => array(),\n\t\t\t),\n\t\t\t'lp-text-shadow' => array(\n\t\t\t\t'config' => array(),\n\t\t\t),\n\t\t\t'typography' => array( 'hidden' => true ),\n\t\t\t'layout' => array( 'hidden' => true ),\n\t\t\t'borders' => array( 'hidden' => true ),\n\t\t\t'animation' => array( 'hidden' => true ),\n\t\t\t'responsive' => array( 'hidden' => true ),\n\t\t\t'styles-templates' => array( 'hidden' => true ),\n\t\t\t'shadow' => array( 'hidden' => true ),\n\t\t\t'background' => array( 'hidden' => true ),\n\t\t);\n\t}", "public function getComptes()\n {\n return $this->comptes;\n }" ]
[ "0.63539886", "0.5941304", "0.59308463", "0.59308463", "0.5926047", "0.5848433", "0.5836893", "0.5830251", "0.5760595", "0.575102", "0.57493263", "0.56836706", "0.5656576", "0.5626658", "0.5618085", "0.56091094", "0.5606145", "0.5594883", "0.5584383", "0.5568544", "0.5559526", "0.55521476", "0.55252504", "0.5515827", "0.5512496", "0.5495811", "0.5468893", "0.5462287", "0.5434567", "0.54239106" ]
0.6979502
0
Newsletter Form Serves email form to send newsletter
public function newsletter() { $data['members'] = count($this->admin_model->addresses()); $data['pageTitle'] = 'Newsletter Form'; $data['mainBlock'] = 'email'; $data['modules'] = array('placeholder'); $this->load->view('inc/container', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function newsletter_send_email_post()\n {\n prevent_editor();\n\n $subject = $this->input->post('subject', true);\n $message = $this->input->post('message', false);\n\n $data['newsletter'] = $this->newsletter_model->get_newsletters();\n\n foreach ($data['newsletter'] as $item) {\n //send email\n $this->settings_model->send_email($item->email, $subject, $message);\n }\n\n $this->session->set_flashdata('success', \"Email sent successfully!\");\n redirect($this->agent->referrer());\n }", "function newsletter_form(){\n $content = ' ';\n $content .= '<div class=\"login-form\">';\n $content .= '<div class=\"popupCloseButton\">X</div>';\n $content .= '<div class=\"login-face\">';\n $content .= '<img src=\" '.plugins_url(\"/grumspakke-popup-plugin/img/grumstid-hjerte-lille.png\"). ' \"';\n $content .= 'alt=\"login-face\"></div>';\n $content .= '<div id=\"promotion-header\">';\n $content .= '<h1 id=\"promotion-header-title\">GRUMSTID</h1></div>';\n $content .= '<section class=\"form\">';\n $content .= '<form action=\"#\">';\n $content .= '<div id=\"promotion-body\">';\n $content .= '<p id=\"promotion-body-text\">Bestil din egen grumstid prøvepakke allerede i dag!</p>';\n $content .= '</div>';\n $content .= '<div class=\"input\">';\n $content .= '<input type=\"text\" id=\"username\" placeholder=\"Mette Madsen\" name=\"username\" required><i class=\"fa fa-user fa-1x\"></i>';\n $content .= '</div>';\n $content .= '<div class=\"input\">';\n $content .= '<input type=\"email\" id=\"email\" placeholder=\"[email protected]\" name=\"email\" required><i class=\"fa fa-envelope fa-1x\"></i>';\n $content .= '</div>';\n $content .= '<div id=\"submitForm\">';\n $content .= '<input type=\"submit\" id=\"submitBtn\" name=\"submitBtn\" value=\"Ja, Tak\">';\n $content .= '</div>';\n $content .= '<div id=\"promotion-footer\">';\n $content .= '<p id=\"promotion-footer-text\">Ja, jeg vil gerne modtage min helt egen Grumstid-pakke og blive en del at Grums-family. Jeg modtager derved også Grums-nyheder via e-mail. Jeg kan til enhver tid framelde mig Grums Nyhedsmails</p>';\n $content .= '</div>';\n $content .= '</form>';\n $content .= '</section>';\n $content .= '</div>';\n \n return $content;\n}", "public function SendNewsletter(Request $request)\n {\n $inputs = $request->all();\n\n\n if($inputs['submit'] == 'TEST')\n {\n\n $message = $this->TestEmail($inputs);\n\n flash()->info($message);\n\n }\n else{\n $this->NewsletterToCustomers();\n\n flash()->info('Sending Newsletter to Customers successful');\n }\n\n\n\n // Zurück zum index\n return redirect()->action('AdminNewsController@index');\n\n\n\n\n }", "function subscriber_import_form($parameters){\n\t\t$identifier\t\t\t\t= $this->check_parameters($parameters,\"identifier\",-1);\n\t\t//$subscriber_newsletter = $this->check_parameters($parameters,\"subscriber_newsletter\");\n\t\t\n\t\t$subscriber_file \t= \"\";\n\t\t\n\t\t$out=\"<module name=\\\"subscription\\\" display=\\\"form\\\">\";\n\t\t$out .= \"<page_options>\";\n\t\t$out .= $this->call_command(\"XMLTAG_GENERATE_XML_BUTTON\",Array(\"NEWSLETTER_HOME\",$this->module_command.\"LIST\",LOCALE_NEWSLETTER_HOME));\n\n\t\t$out .= $this->call_command(\"XMLTAG_GENERATE_XML_BUTTON\",Array(\"CANCEL\",$this->module_command.\"SUBSCRIBER_LIST&amp;identifier=$subscriber_newsletter\",LOCALE_CANCEL));\n\t\t$out .= \"</page_options>\";\n\t\t$out .= \"<form name=\\\"newsletter_issue\\\" method=\\\"post\\\" label=\\\"Newsletter Subscription\\\">\";\n\t\t$out .= \"\t<input type=\\\"hidden\\\" name=\\\"identifier\\\"><![CDATA[$identifier]]></input>\";\n\t\t$out .= \"\t<input type=\\\"hidden\\\" name=\\\"prev_command\\\"><![CDATA[$command]]></input>\";\n\t\t$out .= \"\t<input type=\\\"hidden\\\" name=\\\"command\\\"><![CDATA[NEWSLETTER_IMPORT_SAVE]]></input>\";\n\t\t$out .= \"\t<page_sections>\";\n\t\t$out .=\"\t\t\t<section label='Import details'>\";\n/*\n\t\techo $sql=\"select *\t\t\t\t\n\t\t\t\tfrom newsletter_subscription_group inner join newsletter_data on newsletter_data.newsletter_identifier = newsletter_subscription_group.subscriber_group_newsletter\n\t\t\t\twhere subscriber_group_newsletter='$identifier' AND subscriber_group_client = $this->client_identifier order by newsletter_subscription_group.subscriber_group_name\";\n\t\t$result = $this->call_command(\"DB_QUERY\",array($sql));\n\t\twhile ($r = $this->call_command(\"DB_FETCH_ARRAY\",array($result))){\n/*\t\t\t$subscriber_email\t\t= $r[\"subscriber_email\"];\n\t\t\t$subscriber_name\t\t= $r[\"subscriber_name\"];\n\t\t\t$subscriber_company\t\t= $r[\"subscriber_company\"];\n\t\t\t$subscriber_group\t\t= $r[\"subscriber_group\"];\n\t\t\t$subscriber_rtf\t\t\t= $r[\"subscriber_rtf\"];\n\t\t\t$from_subscribe\t\t\t= $r[\"subscriber_verified\"];\n\t\t\t$subscriber_newsletter\t= $r[\"subscriber_newsletter\"];\n\t\t\t$subscriber_identifier = $r[\"subscriber_identifier\"];\n*/\n/*\t\t\t$subscriber_group_identifier = $r[\"subscriber_group_identifier\"];\n\t\t\t$subscriber_group_name = $r[\"subscriber_group_name\"];\n\n\t\t}\n*/\n\t\t$out.=\"<select label='Choose from the \".LOCALE_SUBSCRIBER_GROUP_LABEL.\"' name='subscriber_group'>\";\n\t\t\t\t\t$sql_group =\"select * from newsletter_subscription_group where subscriber_group_newsletter=$identifier and subscriber_group_client=$this->client_identifier\";\n\t\t\t\t\t$result_group = $this->call_command(\"DB_QUERY\",array($sql_group));\n\t\t\t\t\twhile ($r_group = $this->call_command(\"DB_FETCH_ARRAY\",array($result_group))){\n\t\t\t\t\t\t$db_subscriber_group_id = $r_group[\"subscriber_group_identifier\"];\n\t\t\t\t\t\t$db_subscriber_group_name = $r_group[\"subscriber_group_name\"];\n\t\t\t\t\t\t\n\t\t\t\t\t\t$out .= \"<option value='$db_subscriber_group_id'\";\n\t\t\t\t\t\t\t\t$subscriber_group_ids = explode(\"|\",$subscriber_group);\n\t\t\t\t\t\t\t\tif (in_array($db_subscriber_group_id,$subscriber_group_ids))\n\t\t\t\t\t\t\t\t\t\t$out .= \" selected ='true'\";\n\t\t\t\t\t\t\t\t$out .= \t\t\t\t\">\".$db_subscriber_group_name.\"\n\t\t\t\t\t\t\t\t</option>\";\n\t\t\t\t\t}\n\t\t$out.=\"</select>\";\n\n\t\t$out .=\"\t\t\t\t<text><![CDATA[Please select an Excell file with columns Name and Email to Import.]]></text>\";\n\t\t\t$out .=\"\t\t\t\t<input type='file' name='import_file_format_tab' label='File to import'/>\";\n\t\t\n\t\t$out .= \"\t\t</section>\";\n\t\t$out .= \"\t</page_sections>\";\n\t\t$out .= \"<input type=\\\"submit\\\" iconify=\\\"SAVE\\\" />\";\n\t\t$out .= \"</form></module>\";\n\treturn $out;\n\t}", "function SubscrForm()\n {\n ?>\n <h2><?=$this->multi['TXT_SUBSCRIBE'];?></h2>\n <form action=\"<?=_LINK?>news/\" method=post>\n <input type=hidden name=\"task\" value=\"save_reg_data\">\n <input type=hidden name=\"categories\" value=\"all\">\n <?=$this->showErr();?>\n <table border=\"0\" cellspacing=\"3\" cellpadding=\"0\">\n <tr>\n <td aling=\"right\"><?=$this->multi['_FLD_EMAIL'];?>:</td>\n <td><?=$this->Form->TextBox('subscriber', $this->subscriber, 15 );?></td>\n <td colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"<?=$this->multi['TXT_SAVE'];?>\"></td>\n </tr>\n </table>\n </form>\n <?\n }", "function show_newsletter_form() {\n // make sure it is an ajax call\n if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {\n $data = array();\n \n // Get newsletter form information\n $pageNode = get_page_info('newsletter');\n if ($pageNode) {\n $data['introTitle'] = get_obj_field_value($pageNode, 'field_newsletter_intro_title');\n $data['introDescription'] = get_obj_field_value($pageNode, 'field_newsletter_intro_desc');\n }\n \n print theme('newsletter_form_template', $data);\n }\n}", "function newsletter(){\n\t\t$this->form_validation->set_rules('name', '', 'required');\n\t\t$this->form_validation->set_rules('email', '', 'trim|required|valid_email');\n\t\tif($this->form_validation->run() == FALSE){ \n\t\t\techo json_encode(array('data'=>\"All fields are mandatory and email format should be correct.\"));\n\t\t }else{\n\t\t$data['name'] = $this->security->sanitize_filename($this->input->post('name'));\t\t\n\t\t$data['email'] \t= $this->security->sanitize_filename($this->input->post('email'));\t\n\t\t$checkemail = $this->Home_model->checkifemailalreadythere($this->security->xss_clean($data['email']));\t\n\t\tif($checkemail>0){\n\t\t$returndata = $this->Home_model->saveNewsLetter($this->security->xss_clean($data));\n\t\tif($returndata >0)\n\t\t{\t\n\t\t\t$name = $this->security->xss_clean($data['name']);\n\t\t\t$email = $this->security->xss_clean($data['email']);\n\t\t\t$json = json_encode(array(\"email\"=>$email, \"first_name\"=>$name));\n\t\t\t\t\t$curl = curl_init();\n\t\t\t\t\tcurl_setopt_array($curl, array(\n\t\t\t\t\tCURLOPT_URL => \"https://api.sendgrid.com/v3/contactdb/recipients\",\n\t\t\t\t\tCURLOPT_RETURNTRANSFER => true,\n\t\t\t\t\tCURLOPT_ENCODING => \"\",\n\t\t\t\t\tCURLOPT_MAXREDIRS => 10,\n\t\t\t\t\tCURLOPT_TIMEOUT => 30,\n\t\t\t\t\tCURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n\t\t\t\t\tCURLOPT_CUSTOMREQUEST => \"POST\",\n\t\t\t\t\tCURLOPT_POSTFIELDS => \"[\\r\\n $json\\r\\n]\",\n\t\t\t\t CURLOPT_HTTPHEADER => array(\n\t\t\t\t\t \"authorization: Bearer \".SENDGRIDKEY,\n\t\t\t\t\t \"cache-control: no-cache\"\n\t\t\t\t\t ),\n\t\t\t\t\t));\n\t\t\t\t\t$response = curl_exec($curl);\n\t\t\t\t\t$err = curl_error($curl);\n\t\t\t\t\tcurl_close($curl);\n\t\t\t\t\techo json_encode(array('data'=>\"You have successfully subscribed to the newsletter.\"));\n\t\t}else{\n\t\t\techo json_encode(array('data'=>\"Something went wrong!\"));\n\t\t}\t\t\n\t\t}else{\n\t\t\techo json_encode(array('data'=>\"You are already subscribed to the newsletter.\"));\n\t\t}\n\t}//end validation check\n }", "public static function updateEmail() {\n\t\tif(isset($_POST['update'])) {\n\t\t\tif (isset($_POST['email-new'])) {\n\t\t\t\t$newEmail = new Newsletter([\n\t\t\t\t\t'email' => htmlspecialchars($_POST['email-new']),\n\t\t\t\t\t'id' => htmlspecialchars($_GET['id'])\n\t\t\t\t]);\n\n\t\t\t\t$newEmailManager = new NewsletterManager();\n\t\t\t\t$updateEmail = $newEmailManager->update($newEmail);\n\t\t\t\theader('Location: admin.php?page=adminNewsletterView'); \n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\t}", "public function form_email()\n\t{\n\t\tif ($this->errstr)\n\t\t{\n\t\t\tFsb::$tpl->set_switch('error_handler');\n\t\t}\n\n\t\t// Liste des groupes\n\t\t$list_groups = Html::list_groups('email_groups[]', GROUP_SPECIAL|GROUP_NORMAL, $this->data['groups'], true, array(GROUP_SPECIAL_VISITOR));\n\n\t\tFsb::$tpl->set_switch('email_mass');\n\t\tFsb::$tpl->set_vars(array(\n\t\t\t'LIST_GROUPS' =>\t\t$list_groups,\n\t\t\t'VALUE_SUBJECT' =>\t\thtmlspecialchars($this->data['subject']),\n\t\t\t'VALUE_USERS' =>\t\thtmlspecialchars($this->data['users']),\n\t\t\t'VALUE_CONTENT' =>\t\thtmlspecialchars($this->data['content']),\n\t\t\t'CONTENT' =>\t\t\tHtml::make_errstr($this->errstr),\n\n\t\t\t'U_ACTION' =>\t\t\tsid('index.' . PHPEXT . '?p=general_email'),\n\t\t));\n\t}", "public function postForm() {\n add_action('wp_ajax_contactform_action', array($this, 'send'));\n add_action('wp_ajax_nopriv_contactform_action', array($this, 'send'));\n }", "function form_mail($form=\"\", $function=\"\") {\n\n\tglobal $onload, $su, $f;\n\n\t// init memberaccess integration\n\t// fm\\Memberaccess::init();\n\n\n\t// create form definition path and load entries\n\t$path = FORM_MAIL_CONTENT_BASE . FORM_MAIL_PATH . \"/\" . $form;\n\tfm\\Entries::load($path);\n\n\n\t// memberaccess integration\n\tif(class_exists(\"ma\\Access\")) {\n\t\tdefine(\"FORM_MAIL_ACCESS_SUPPORT\", true);\n\t}\n\telse {\n\t\tdefine(\"FORM_MAIL_ACCESS_SUPPORT\", false);\n\t}\n\n\n\t$ret = \"\";\n\t$ret_send = \"\";\n\n\n\t// return script include\n\t$ret .= '<script type=\"text/javascript\" src=\"' . FORM_MAIL_BASE . 'script/form_mail.js\"></script>';\n\n\t// add to onload\n\t$onload .= \"form_mail_init();\";\n\n\n\tif (file_exists($path . \".ini\")) {\n\n\t\tswitch (strtolower($function)) {\n\n\n\t\t\t// admin\n\t\t\tcase \"administration\":\n\t\t\t\tfm\\Admin::fetch($path);\n\t\t\t\t$ret .= fm\\Admin::render($form);\n\t\t\t\tbreak;\n\n\n\t\t\t// show form\n\t\t\tdefault:\n\n\t\t\t\t$selector = new fm\\Selector($path);\n\n\t\t\t\t$ret .= $selector->render(\"titel\");\n\n\t\t\t\t// load form definition\n\t\t\t\t$form_ini = parse_ini_file($path . \".ini\", true);\n\n\t\t\t\t$formid = false;\n\n\t\t\t\t$block_idx = 0;\n\n\t\t\t\t// create global block\n\t\t\t\t$global = new fm\\Block();\n\t\t\t\t$b = new fm\\Block();\n\n\n\t\t\t\t$ret .= \"<hr>\";\n\n\t\t\t\t// create form\n\t\t\t\t$ret .= '<div id=\"form_mail_form\"><form method=\"post\" action=\"#\">';\n\n\t\t\t\t\t// iterate form lines\n\t\t\t\t\tforeach ($form_ini as $text => $block) {\n\n\t\t\t\t\t\t// load settings\n\t\t\t\t\t\tif ($text == \"_settings\") {\n\t\t\t\t\t\t\t$settings = $block;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// set block\n\t\t\t\t\t\telse {\n\n\t\t\t\t\t\t\t$b->set($text, $block);\n\t\t\t\t\t\t\t$ret .= $b->render();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\n\t\t\t\t\t// add submit button\n\t\t\t\t\t$ret .= '<p><input type=\"submit\" value=\"absenden\"></p>';\n\t\t\t\t\t$ret .= '<input name=\"action\" type=\"hidden\" value=\"form_mail_send\">';\n\n\t\t\t\t$ret .= \"</form></div>\";\n\n\n\t\t\t\t// if logged user -> show filtered list of entries from logged user\n\t\t\t\tif (FORM_MAIL_ACCESS_SUPPORT && \\ma\\Access::user()) {\n\t\t\t\t\t// list current entries\n\t\t\t\t\tfm\\Entries::filter(\"meta:user\", \\ma\\Access::User()->username());\n\t\t\t\t\t$ret .= fm\\View::list();\n\t\t\t\t}\n\n\n\n\t\t}\n\t}\n\n\telse {\n\n\t\t$ret .= '<div class=\"xh_fail\">Form definition not found</div>';\n\t}\n\n\n\t// EXECUTE SEND ACTION\n\tif (fm\\Session::post(\"action\") == \"form_mail_send\") {\n\n\n\t\t// no setting in form definition\n\t\t// use global settings\n\t\tif (!$settings) {\n\n\t\t\t$settings = [\n\t\t\t\t// \"target\" => \"\",\n\t\t\t\t\"sender\" => fm\\Config::mail_sender(),\n\t\t\t\t\"address\" => fm\\Config::mail_address(),\n\t\t\t\t\"subject\" => fm\\Config::mail_subject()\n\t\t\t];\n\t\t}\n\n\t\t$sender = new fm\\Sender($settings[\"sender\"], $form);\n\t\t$sender->set_key_names([\"Frage\",\"Antwort\"]);\n\t\t$sender->add_data($_POST);\n\n\t\t$res = $sender->send($settings[\"address\"], $settings[\"subject\"]);\n\n\n\t\tif ($res) {\n\t\t\t$ret_send .= '<div class=\"xh_info\">' . fm\\Text::mail_sent() . '</div>';\n\t\t}\n\t\telse {\n\t\t\t$ret_send .= '<div class=\"xh_warning\">' . fm\\Text::mail_sent_fail(). '</div>';\n\t\t}\n\n\t\t// create remember string\n\t\t$remember = $_POST;\n\t\t$remember[\"action\"] = \"ma_remember\";\ndebug($remember);\n\t\tforeach ($remember as $key => $val) {\n\t\t\t$rem[] = $key . \"=\" . $val;\n\t\t}\n\n\n\t\t// return link\n\t\t$ret_send .= '<p><a href=\"?' . $su . '&' . implode(\"&\", $rem) . '\">neue Bewertung</a></p>';\n\n\t\treturn $ret_send;\n\t}\n\n\n\t// return form\n\telse {\n\t\treturn $ret;\n\t}\n}", "function sitewide_newsletters()\r\n{\r\n\tglobal $current_user, $wpdb;\r\n\t$query_fields = array( 'fields' => array( 'user_login', 'user_email' ) );\r\n\tif ( array_key_exists( \"role\", $_POST ) && trim( $_POST[\"role\"] ) != \"\" ) {\r\n\t\t$query_fields = array( 'fields' => array( 'user_login', 'user_email' ), 'role' => trim( $_POST[\"role\"] ) );\r\n\t}\r\n\t$user_query = new WP_User_Query( $query_fields );\r\n\t$users = $user_query->get_total();\r\n\t\r\n\t$message = \"\";\r\n\r\n\t// if sending a newsletter\r\n\tif ( @$_POST[\"newsletter\"] != \"\" && @$_POST[\"subject\"] != \"\" && @$_POST[\"fromname\"] != \"\" && @$_POST[\"fromemail\"] != \"\" )\r\n\t{\r\n\t\ttry {\r\n\t\r\n\t\t\t$newsletter = stripslashes( trim( $_POST[\"newsletter\"] ) );\r\n\t\t\t$subject = stripslashes( trim( $_POST[\"subject\"] ) );\r\n\t\t\t\r\n\t\t\t$message_headers = 'From: \"' . addslashes($_POST[\"fromname\"]) . '\" <' . addslashes($_POST[\"fromemail\"]) . '>' . \"\\r\\n\" .\r\n\t\t\t'Reply-To: ' . get_site_option(\"admin_email\") . '' . \"\\r\\n\" .\r\n\t\t\t'X-Mailer: PHP/' . phpversion();\r\n\t\t\t\r\n\t\t\t$failed = \"\";\r\n\t\t\t$sent = 0;\r\n\t\t\t\r\n\t\t\tif (@$_POST[\"test\"] == \"\")\r\n\t\t\t{\r\n\t\t\t\r\n\t\t\t\t$user_query = new WP_User_Query( $query_fields );\r\n\t\t\t\t$emails = $user_query->get_results();\r\n\t\t\t\r\n\t\t\t\tforeach ( $emails as $email )\r\n\t\t\t\t{\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\r\n\t\t\t\t\t\t$e = $email->user_email;\r\n\t\t\t\t\t\tif ( wp_mail( $e, $subject, $newsletter, $message_headers ) )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$sent++;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif ( trim( $e ) == \"\" ) {\r\n\t\t\t\t\t\t\t\t$failed .= \"No email address for user \" . $email->user_login . \"\\r\\n\";\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t$failed .= $e . \"\\r\\n\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t} catch (Exception $e) {\r\n\t\t\r\n\t\t\t\t\t\t$failed .= \"Error with \" . $e . \": \" . $e->getMessage() . \"\\r\\n\";\r\n\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t} else {\r\n\r\n\t\t\t\t$email = get_site_option(\"admin_email\");\r\n\t\t\t\r\n\t\t\t\ttry {\r\n\t\t\t\t\r\n\t\t\t\t\tif ( wp_mail( $email, $subject, $newsletter, $message_headers ) ) {\r\n\r\n\t\t\t\t\t\t$sent++;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$failed .= \"Error: test message could not be sent to \" . $email . \"\\r\\n\";\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t} catch (Exception $e) {\r\n\r\n\t\t\t\t\t$failed .= \"Error sending to \" . $email . \": \" . $e->getMessage() . \"\\r\\n\";\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t}\r\n\t\t\t$message = \"<p>Your message has been sent to \" . $sent . \" email addresses (\" . $users . \" users in total).</p>\";\r\n\t\t\tif ($failed != \"\")\r\n\t\t\t{\r\n\t\t\t\t$message .= '<p>Failed addresses:</p><p><textarea cols=\"30\" rows=\"12\" style=\"width: 100%\">' . $failed . '</textarea></p>';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} catch (Exception $e) {\r\n\t\t\r\n\t\t\t$message = \"<p>An error was encountered: \" . $e->getMessage() . \"</p>\";\r\n\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\tprint '\r\n\t<div class=\"wrap\">\r\n\t';\r\n\tsitewide_newsletters_wp_plugin_standard_header( \"GBP\", \"Sitewide Newsletter\", \"Chris Taylor\", \"[email protected]\", \"http://wordpress.org/extend/plugins/sitewide-newsletter/\" );\r\n\tprint '\r\n\t<h2>Sitewide Newsletter</h2>\r\n\t\r\n\t' . $message . '\r\n\t\r\n\t<p>Enter your newsletter below which will be emailed to ' . $users . ' users.</p>\r\n\t\r\n\t<form action=\"users.php?page=sitewide_newsletters\" method=\"post\">\r\n\t\r\n\t\t<fieldset>\r\n\t\t\r\n\t\t<legend>Send a newsletter</legend>\r\n\t\t\r\n\t\t<p><label for=\"fromname\" style=\"float: left;width: 15%;\">From name</label><input type=\"text\" name=\"fromname\" id=\"fromname\" style=\"width: 80%\" value=\"' . get_site_option(\"site_name\") . '\" /></p>\r\n\t\t\r\n\t\t<p><label for=\"fromemail\" style=\"float: left;width: 15%;\">From email</label><input type=\"text\" name=\"fromemail\" id=\"fromemail\" style=\"width: 80%\" value=\"' . get_site_option(\"admin_email\") . '\" /></p>\r\n\t\t\t\r\n\t\t<p><label for=\"subject\" style=\"float: left;width: 15%;\">Subject</label><input type=\"text\" name=\"subject\" id=\"subject\" style=\"width: 80%\" /></p>\r\n\t\t\t\r\n\t\t<p><label for=\"newsletter\" style=\"float: left;width: 15%;\">Newsletter</label><textarea name=\"newsletter\" id=\"newsletter\" cols=\"30\" rows=\"6\" style=\"width: 80%\"></textarea></p>\r\n\t\t\r\n\t\t<p><label for=\"role\" style=\"float: left;width: 15%\">Role</label><select name=\"role\" id=\"role\">\r\n\t\t\t<option value=\"\">All</option>\r\n\t\t';\r\n\t\t$roles = get_editable_roles();\r\n\t\tforeach( $roles as $role ) {\r\n\t\t\tprint '\r\n\t\t\t<option value=\"' . $role[\"name\"] . '\">' . $role[\"name\"] . '</option>\r\n\t\t\t';\r\n\t\t}\r\n\t\tprint '\r\n\t\t</select> Send this newsletter to users with just one role, or to all users</p>\r\n\t\t\r\n\t\t<p><label for=\"subject\" style=\"float: left;width: 15%;\">Test newsletter</label><input type=\"checkbox\" name=\"test\" id=\"test\" /> This will just send the newsletter to ' . get_site_option(\"admin_email\") . '</p>\r\n\t\t\r\n\t\t<p><label for=\"send_sitewide_newsletter\" style=\"float: left;width: 15%;\">Send newsletter</label><input type=\"submit\" name=\"send_sitewide_newsletter\" id=\"send_sitewide_newsletter\" value=\"Send newsletter\" class=\"button\" /></p>\r\n\t\t\r\n\t\t</fieldset>\r\n\r\n\t</form>\r\n\t';\r\n\tsitewide_newsletters_wp_plugin_standard_footer( \"GBP\", \"Sitewide Newsletter\", \"Chris Taylor\", \"[email protected]\", \"http://wordpress.org/extend/plugins/sitewide-newsletter/\" );\r\n\tprint '\r\n\t</div>\r\n\t';\r\n}", "function send()\n\t\t{\n\n\t\t\t$this->load->library('form_validation');\t\t//Loading form_validation, can also be\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tloaded in autoload.\n\t\t\t$this->form_validation->set_rules('name','Name','trim|required');\n\t\t\t$this->form_validation->set_rules('email','Email Address','trim|required|valid_email');\n\n\t\t\tif($this->form_validation->run() == FALSE)\n\t\t\t{\n\t\t\t\t$this->load->view('newsletter');\t\t//Redirecting to same form page.\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//Validation has passed, Now send the email.\n\n\t\t\t\t$name = $this->input->post('name');\t\t// or $name = $this->input->$_POST['name'];\n\t\t\t\t$email = $this->input->post('email'); // or $email = $this->input->$_POST['email'];\n\n\t\t\t\t$config = Array(\n\t\t\t\t'protocol' => 'smtp',\n\t\t\t\t'smtp_host' => 'ssl://smtp.googlemail.com',\n\t\t\t\t'smtp_port' => 465,\n\t\t\t\t'smtp_user' => '[email protected]',\n\t\t\t\t'smtp_pass' => '1101297141bismillah'\n\t\t\t\t\n\t\t\t);\n\t\t\t\n\n\t\t\t\t$this->load->library('email',$config);\n\t\t\t\t$this->email->set_newline(\"\\r\\n\");\n\n\t\t\t\t$this->email->from('[email protected]','Amir Mustafa');\n\t\t\t\t$this->email->to('email');\n\t\t\t\t$this->email->subject('Test Newsletter Sign Up Confirmation!!.');\n\t\t\t\t$this->email->message('You are now signed in');\n\n\t\t\t\t$path = $this->config->item('server_root');\n\t\t\t\t$file = $path.'/ci/attachments/newsletter1.txt';\t//create newsletter.txt in\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tattachments file.\n\t\t\t\t$this->email->attach($file);\n\n\t\t\t\tif($this->email->send())\n\t\t\t\t{\n\t\t\t\t\t/*echo \"Your Email was sent. fool.\";*/\n\t\t\t\t\t$this->load->view('newsletter_signup_page');\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tshow_error($this->email->print_debugger());\n\t\t\t\t}\n\n\n\t\t\t}\n\t\t\t\n\n\t\t\t\n\n\t\t}", "function compose_mail()\n\t{\n\t\t$from = $title = $message = $email = '';\n\n\t\t$message = __('Message from page: ').$this->page.\"\\n\";\n\t\tforeach ($this->form as $key => $value)\n\t\t{\n\t\t\t$message .= $key.' = '.$value.\"\\n\";\n\t\t}\n\n\t\t// reserved words\n\t\tif (isset($this->form['email']) != '') \t{ $email .= $this->form['email'].' ';\t}\n\t\tif (isset($this->form['name']) != '') \t{ $from .= $this->form['name'].' ';\t}\n\t\tif (isset($this->form['title']) != '')\t{ $title .= $this->form['title'].' ';\t}\n\n\t\tif ((get_option('wordpress_api_key') != '') AND (file_exists('/wp-content/plugins/fcc/akismet.php'))) return $this->akismet_sendmail($message,$from,$email,$title);\n\t\telse return $this->sendmail($message,$from,$email,$title);\n\n\t}", "private function showNewsForm(){\n\t\t$oldInfo=$this->generated->getNewsPost($_GET['newsID']);\n\t\tif($oldInfo){\n\t\t\textract($oldInfo);\n\t\t}\n\t\tif($_POST['news']){\n\t\t\t$html.='<p class=\"note\"><strong>'.$this->msg.'</strong></note>'.\"\\n\";\t\t\t\t\n\t\t\t\textract($_POST);\n\t\t}\n\t\tif(!$userID){\n\t\t\t$userID=$_SESSION['userID'];\n\t\t\t$newsID=0;\n\t\t}\n\t\t//Form starts here\n\t\t//$html.='<p class=\"note\"><em>Note: You can use &lt;h3&gt; tags for headings, &lt;b&gt; tags to make text bold, &lt;i&gt; tags to italicize text, and &lt;a&gt; tags for links</em></p>'.\"\\n\";\t\t\n\t\t$html.='<div class=\"pageForm\">'.\"\\n\";\t\n\t\t$html.='<form action=\"'.$_SERVER['REQUEST_URI'].'\" method=\"post\" id=\"form\" />'.\"\\n\";\n\t\t$html.='<input type=\"hidden\" name=\"userID\" value=\"'.$userID.'\" id=\"userID\" />'.\"\\n\";\t\n\t\t$html.='<input type=\"hidden\" name=\"newsID\" value=\"'.$newsID.'\" id=\"newsID\" />'.\"\\n\";\t\n\t\t$html.='<div class=\"h3\"><h3>'.\"\\n\";\t\n\t\t$html.='<label class=\"hidden\" for=\"newsTitle\">Title: </label>'.\"\\n\";\t\n\t\t$html.='<input type=\"text\" name=\"newsTitle\" placeholder=\"Headline\" value=\"'.htmlentities(stripslashes($newsTitle)).'\" id=\"newsTitle\" />'.\"\\n\";\t\n\t\t$html.='</h3></div>'.\"\\n\";\t\n\t\t$html.=$this->displayEdit();\n\t\t$html.='<textarea name=\"newsText\" id=\"pageContent\">'.$this->model->stripHTMLTags(stripslashes($newsText)).'</textarea>'.\"\\n\";\t\t\n\t\t$html.='<p class=\"newsSubmit\"><input type=\"submit\" name=\"cancel\" value=\"Cancel\" id=\"newsCancel\"><input type=\"submit\" name=\"news\" value=\"Post\" id=\"newsPost\"></p>'.\"\\n\";\n\t\t$html.='</form>'.\"\\n\";\t\t\t\n \t$html.='</div>'.\"\\n\";\t\n\t\treturn $html;\n\t}", "function send(){\n\t\t$this->load->library('form_validation');\n\t\t\n\t\t//params: field name, error message, validation rules\n\t\t$this->form_validation->set_rules('name', 'Name', 'trim|required');\n\t\t$this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');\n\t\t//End of form validation\n\t\t\n\t\t//call run method\n\t\tif($this->form_validation->run() == FALSE){\n\t\t\t//reload it\n\t\t\t$this->load->view('newsletter');\n\t\t}else{\n\t\t\t//validation has passed. Now send the email\n\t\t\t$name = $this->input->post('name');\n\t\t\t$email = $this->input->post('email');\n\t\t\t\n\t\t\t//send email\n\t\t\t\t\t$this->load->library('email'); // removed config \n\t\t\t$this->email->set_newline(\"\\r\\n\");\n\t\t\t\n\t\t\t$this->email->from('[email protected]', 'Phil Walker');\n\t\t\t$this->email->to($email);\n\t\t\t$this->email->subject('Hey phil, your on your way to becoming a PHP developer!');\n\t\t\t$this->email->message('Program 3 hours every day and you will become the best!');\n\t\n\t\t\t//item means grab from file\n\t\t\t//$path = $this->config->item('server_root');\n\t\t\t//points directly to file to attach\n\t\t\t$file = base_URL() . '/attachments/newsletter1.txt';\n\t\n\t\t\t//attach to email\n\t\t\t$this->email->attach($file);\n\t\t\t\n\t\t\t//Confirm if sent\n\t\t\tif($this->email->send()){\n\t\t\t\t//echo 'Your email was sent.';\n\t\t\t\t$this->load->view('signup_confirmation_view');\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\tshow_error($this->email->print_debugger());\n\t\t\t}\t\n\t\t}\n\n\t}", "public function form(){\n $params = $this->getParams();\n $data = array(\n 'id' => !empty($params[1]) ? $params[1] : 0,\n 'subject' => '',\n 'text' => '',\n 'datetime' => date('Y-m-d H:i:s')\n );\n \n if (!$this->error) $this->error = '';\n if (!$this->warning) $this->warning = '';\n \n \n \n if (!empty($params[1])){\n $dm = Lib_DataMapper::getInstance();\n $model = $dm->getNews($params[1]);\n \n if (!$model->loaded()) $this->error = 'Запись не найдена';\n else $data = $model->getData();\n }\n \n if ($this->getGlobalVar()->post('subject') && !$this->error){\n $lstFields = array('datetime', 'subject', 'text');\n foreach ($lstFields as $fieldName){\n $data[$fieldName] = $this->getGlobalVar()->post($fieldName);\n }\n }\n \n $this->data = $data;\n }", "public static function autosendNewsletter()\n\t{\n\t\t// test si le plugin est actif\n\t\tif (!newsletterPlugin::isActive()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// test si l'envoi automatique est activé\n\t\tif (!newsletterPlugin::getAutosend()) {\n\t\t\treturn;\n\t\t} else {\n\t\t\t$datas = self::getlist(true);\n \tif (!is_object($datas)) {\n \t\treturn;\n \t} else {\n\t\t\t\tglobal $core;\n\t\t \ttry {\n\t\t\t\t\t$datas->moveStart();\n \t\twhile ($datas->fetch()) { \n \t\t\tself::sendNewsletter($datas->subscriber_id); \n \t\t}\n\t\t\t\t} catch (Exception $e) { \n\t\t\t\t\t$core->error->add($e->getMessage()); \n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t} \t\n\t\t}\t\n\t}", "function SignupForm() {\r\n\t\tif($this->ReadyToReceiveSubscribtions()) {\r\n\t\t\t// Create fields\r\n\t\t\t$member = Member::currentUser();\r\n\t\t\t$emailField = null;\r\n\t\t\t$emailRequired = true;\r\n\t\t\tif(!$member) {\r\n\t\t\t\t$member = new Member();\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\t$this->email = $member->Email;\r\n\t\t\t\tif($this->email) {\r\n\t\t\t\t\t$emailRequired = false;\r\n\t\t\t\t\t$emailField = new ReadonlyField('CampaignMonitorEmail', _t(\"CAMPAIGNMONITORSIGNUPPAGE.EMAIL\",'Email'), $this->email);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(!$emailField) {\r\n\t\t\t\t$emailField = new EmailField('CampaignMonitorEmail', _t(\"CAMPAIGNMONITORSIGNUPPAGE.EMAIL\",'Email'), $this->email);\r\n\t\t\t}\r\n\t\t\tif($this->ShowAllNewsletterForSigningUp) {\r\n\t\t\t\t$signupField = $member->getCampaignMonitorSignupField(null, \"SubscribeManyChoices\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$signupField = $member->getCampaignMonitorSignupField($this->ListID, \"SubscribeChoice\");\r\n\t\t\t}\r\n\t\t\t$fields = new FieldList(\r\n\t\t\t\t$emailField,\r\n\t\t\t\t$signupField\r\n\t\t\t);\r\n\t\t\t// Create action\r\n\t\t\t$actions = new FieldList(\r\n\t\t\t\tnew FormAction('subscribe', _t(\"CAMPAIGNMONITORSIGNUPPAGE.UPDATE_SUBSCRIPTIONS\", \"Update Subscriptions\"))\r\n\t\t\t);\r\n\t\t\t// Create Validators\r\n\t\t\tif($emailRequired) {\r\n\t\t\t\t$validator = new RequiredFields('CampaignMonitorEmail');\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$validator = new RequiredFields();\r\n\t\t\t}\r\n\t\t\t$form = new Form($this, 'SignupForm', $fields, $actions, $validator);\r\n\t\t\tif($member->exists()) {\r\n\t\t\t\t$form->loadDataFrom($member);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$form->Fields()->fieldByName(\"CampaignMonitorEmail\")->setValue($this->email);\r\n\t\t\t}\r\n\t\t\treturn $form;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn _t(\"CampaignMonitorSignupPage.NOTREADY\", \"You can not suscribe to this newsletter at present.\");\r\n\t\t}\r\n\t}", "public function displayForm() {\r\n $testEmailAddress = $this->modx->getOption('nfTestEmailAddress', $this->props, '');\r\n if (strpos($testEmailAddress, '@') === false) { // it's a username\r\n $u = $this->modx->getObject($this->prefix . 'modUser', array('username' => $testEmailAddress));\r\n if ($u) {\r\n $profile = $u->getOne('Profile');\r\n if ($profile) {\r\n $testEmailAddress = $profile->get('email');\r\n }\r\n }\r\n\r\n }\r\n if (empty($testEmailAddress)) {\r\n $profile = $this->modx->user->getOne('Profile');\r\n if ($profile) {\r\n $testEmailAddress = $profile->get('email');\r\n unset($profile);\r\n }\r\n }\r\n\r\n $this->modx->setPlaceholder('nf_test_email_address', $testEmailAddress);\r\n\r\n $groups = $this->modx->getOption('groups', $this->props, 'Subscribers');\r\n if (empty($groups)) {\r\n $groups = 'Subscribers';\r\n }\r\n $this->modx->setPlaceholder('nf_groups', $groups);\r\n\r\n\r\n $tags = $this->modx->getOption('tags', $this->props, '');\r\n $this->modx->setPlaceholder('nf_tags', $tags);\r\n\r\n /* @var $tempPage modResource */\r\n\r\n $content = $this->emailText;\r\n $this->updatePreviewPage($content);\r\n\r\n $this->modx->setPlaceholder('nf_email_text', $content);\r\n $subjectTpl = $this->modx->getOption('nfSubjectTpl', $this->props);\r\n $subjectTpl = empty($subjectTpl)? 'NfEmailSubjectTpl' : $subjectTpl;\r\n $this->modx->setPlaceholder('nf_email_subject',$this->modx->getChunk($subjectTpl));\r\n $this->modx->setPlaceholder('nf_tweet_text', $this->tweetText);\r\n return $this->modx->getChunk($this->formTpl);\r\n }", "function SendContactForm($data, $form) \n\t{\n\t \t//Set data\n\t\t$From = $data['Email'];\n\t\t$To = $this->Mailto;\n\t\t$Subject = \"Website Contact message\"; \t \n\t\t$email = new Email($From, $To, $Subject);\n\t\t//set template\n\t\t$email->setTemplate('ContactEmail');\n\t\t//populate template\n\t\t$email->populateTemplate($data);\n\t\t//send mail\n\t\t$email->send();\n\t \t//return to submitted message\n\t\tDirector::redirect(Director::baseURL(). $this->URLSegment . \"/?success=1\");\n\n\t}", "public function actionMailsignup()\n {\n \n $model = new MailSignupForm();\n\n if($model->load(Yii::$app->request->post()) && $model->NewsletterSignup()){\n\n Yii::$app->session->setFlash('mailConfirmation');\n }\n \n return $this->render('mailsignup', [\n 'model' => $model,\n ]);\n \n }", "function tzsms_ui_send_sms_form(&$form_state) {\n $form['message'] = array(\n '#type' => 'textarea',\n '#title' => t('SMS Message'),\n '#description' => t('Enter any text you want to send as SMS. Maximum message length 459 characters.'),\n '#required' => TRUE,\n );\n\n $form['recipient'] = tzsms_ui_recipient_form();\n\n $form['send'] = array(\n '#type' => 'submit',\n '#value' => t('Send'),\n );\n return $form;\n}", "function post($data) {\n $smarty = new Smarty; \n $error=$this->checkdata($data);\n if ($error) {\n $this->show($data,$error);\n return;\n }\n $smarty->assign(\"data\",$data);\n $smarty->assign(\"path\",$subscr);\n $smarty->assign(\"from\",$this->from);\n $post=$smarty->fetch(\"{$this->path}subscribe/post.tpl\");\n $mail=new html_mime_mail();\n $mail->add_html($post);\n $mail->build_message('win'); // ¥á«¨ ­¥ \"win\", â® ª®¤¨p®¢ª  koi8\n $mail->send(\"localhost\",\"[email protected]\",\"[email protected]\",\"Subscription form to MDB\",\"Reply-To: $data[email]\");\n $mail->send(\"localhost\",\"[email protected]\",\"[email protected]\",\"Subscription form to MDB\",\"Reply-To: $data[email]\");\n $smarty->display(\"{$this->path}subscribe/ok.tpl\");\n }", "public function suscribe(){\n\t\t$email = $_POST['email'];\n\n\t\t//$avail = $this->enmodel->liketable(\"suscribe\",$email);\n\t\t$avail = $this->enmodel->getWhere(\"newsuscribe\",\"emailid\",$email);\n\t\t//print_r($avail);\n\t\t//print_r($avail[0]['emailid']);\n\t\tif(!empty($avail))\n\t\t{\n\t\t\t$data = array(\n\t\t\t\t\t\t\"val\" => 1\n\t\t\t\t\t);\n\t\t\t\n\t\t\t$message = $this->load->view(\"email/suscribe.php\",$data, TRUE);\n\t\t\t$to = $email;\n\t $subject = 'Do not reply email';\n\t $this->suscribeMail($to,$subject, $message);\n\t $this->load->view(\"Home/page1\",$data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$data = array(\n\t\t\t\t\"emailid\" => $email,\n\t\t\t);\n\t\t\t$test = $this->enmodel->add(\"newsuscribe\",$data);\n\t\t\t//echo $test;exit;\n\t\t\t$data = array(\n\t\t\t\t\t\t\"val\" => 0\n\t\t\t\t\t);\n\t\t\t$this->load->view(\"Home/page1\",$data);\n\t\t}\n\n\n\t\t// PHP Mailer Required\n\t\t//require_once(APPPATH.'third_party/phpmailer/class.phpmailer.php');\n\t\t// Create a Array For save data enquiryform table\n\t\t/*$data = array(\n\t\t\t\t\"email\" => $email\n\t\t\t);\n\t\t// Save Data in enquiry form table and return enquiry id\n\t\t$this->enmodel->add(\"suscribe\",$data);\n*/\n\t\t// SMTP MAIL SYSTM FOR CUSTOMER\n\t\t\t/*$mail = new PHPMailer();\n\t\t\t$mail->IsSMTP();\n\t\t\t$mail->SMTPDebug = 0;\n\t\t\t$mail->SMTPAuth = true;\n\t\t\t$mail->SMTPSecure = \"ssl\";\n\t\t\t$mail->Port = 465;\n\t\t\t$mail->Host = \"smtp.gmail.com\";\n\t\t\t$mail->Username = \"[email protected]\";\n\t\t\t$mail->Password = \"xxxxxx\";\n\t\t\t$mail->Mailer = \"smtp\";\n\t\t\t//Send EMAIL\n\t\t\t$mail->SetFrom($email);\n\t\t\t//$mail->SetFrom(\"[email protected]\", $_POST[\"name\"]);\n\t\t\t$mail->AddReplyTo($email);\n\t\t\t$mail->AddAddress($email);\n\t\t\t$mail->Subject = \"Suscribe\";\n\t\t\t$mail->WordWrap = 80;\n\t\t\t$message = \"Thankyou for suscribe\";\n\t\t\t//$mail->MsgHTML($_POST[\"content\"]);\n\t\t\t$mail->MsgHTML($message);\n\t\t\t$mail->Body = $this->load->view(\"email/suscribe.php\",$data, TRUE);\n\t\t\t//$mail->IsHTML(true);\n\t\t\t$mail->IsHTML(true);\n\t\t\tif(!$mail->Send()) {\n\t\t\t\t$this->load->view(\"Home/page1\");\n\t\t\t} else {\n\n\t\t\t\t$this->load->view(\"Home/page1\");\n\t\t\t}*/\n\t}", "function render_compose_mail() {\n\t?>\n <form action=\"send_mail.php?request=Inbox\" method=\"post\" name=\"compose\" id=\"compose\">\n <label>Recipient</label>\n <input class=\"span7\" type=\"text\" name=\"to\"><br/>\n <label>Subject</label>\n <input class=\"span7\" type=\"text\" name=\"subject\"><br/>\n <label>Message</label>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n <textarea class=\"span7\" name=\"content\" id=\"content\"></textarea><br/>\n <input type=\"hidden\" name=\"from\" value=\"<?php echo $_SESSION['username']?>\" />\n <input class=\"btn btn-info\" type=\"submit\" value=\"Send\" />\n </form>\n\t<?php\t\n\t}", "function smarty_cms_function_contact_form($params, &$smarty) {\n\n\tif (empty($params['email'])){\n\t\techo '<div class=\"formError\">An email address must be specified in order to use this plugin.</div>';\n\t\treturn;\n\t}else{\n\t\t$to = $params['email'];\n\t}\n\t\n\t$style = true; // Use default styles\n\tif (!empty($params['style'])) $style = $params['style']; // Except if \"false\" given in params\n\t\n\t// Default styles\n\t$inputStyle = 'style=\"width:100%;border: 1px solid black; margin:0 0 1em 0;\"'; // input boxes\n\t$taStyle = 'style=\"width:100%; border: 1px solid black;\"'; // TextArea boxes\n\t$formStyle = 'style=\"width:30em; important; font-weight: bold;\"'; // form\n\t$errorsStyle = 'style=\"color: white; background-color: red; font-weight: bold; border: 3px solid black; margin: 1em;\"'; // Errors box (div)\n $labelStyle = 'style=\"display:block;\"';\n $buttonStyle = 'style=\"float:left; width:50%; margin-top:1em;\"';\n $fieldsetStyle = 'style=\"padding:1em;\"';\n\n\t$errors=$name=$email=$subject=$message = '';\n\tif($_SERVER['REQUEST_METHOD']=='POST'){\n\t\tif (!empty($_POST['name'])) $name = cfSanitize($_POST['name']);\n\t\tif (!empty($_POST['email'])) $email = cfSanitize($_POST['email']);\n\t\tif (!empty($_POST['subject'])) $subject = cfSanitize($_POST['subject']);\n\t\tif (!empty($_POST['message'])) $message = $_POST['message'];\n\n\t\t//Mail headers\n\t\t$extra = \"From: $name <$email>\\r\\n\";\n\t\t$extra .= \"Content-Type: text/plain\\r\\n\";\n\t\t\n\t\tif (empty($name)) $errors .= \"\\t\\t<li>\" . 'Please Enter Your Name' . \"</li>\\n\";\n\t\tif (empty($email)) $errors .= \"\\t\\t<li>\" . 'Please Enter Your Email Address' . \"</li>\\n\";\n\t\tif (empty($subject)) $errors .= \"\\t\\t<li>\" . 'Please Enter a Subject' . \"</li>\\n\";\n\t\tif (empty($message)) $errors .= \"\\t\\t<li>\" . 'Please Enter a Message' . \"</li>\\n\";\n\t\tif (!validEmail($email)) $errors .= \"\\t\\t<li>\" . 'Your Email Address is Not Valid' . \"</li>\\n\";\n\t\t\n\t\tif (!empty($errors)) {\n\t\t\techo '<div class=\"formError\" ' . (($style) ? $errorsStyle:'') . '>' . \"\\n\";\n\t\t\techo '<p>Error(s) : </p>' . \"\\n\";\n\t\t\techo \"\\t<ul>\\n\";\n\t\t\techo $errors;\n\t\t\techo \"\\t</ul>\\n\";\n\t\t\techo \"</div>\";\n\t\t}\n\t\telseif (@mail($to, $subject, $message, $extra)) {\n\t\t\techo '<div class=\"formMessage\">Your message was successfully sent.</div>' . \"\\n\";\n\t\t\treturn;\n\t\t}\n\t\telse {\n\t\t\techo '<div class=\"formError\" ' . (($style) ? $errorsStyle:'') . '>Sorry, the message was not sent. The server may be down!</div>' . \"\\n\";\n\t\t\treturn;\n\t\t}\n\t}\n\t?>\n\n\t<!-- CONTACT_FORM -->\n\t<form action=\"<?php $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'] ?>\" method=\"post\" <?php echo ($style) ? $formStyle:''; ?>>\n <fieldset <?php echo ($style) ? $fieldsetStyle:''; ?>>\n <legend>Contact</legend>\n\t\t\t<label for=\"name\" <?php echo ($style) ? $labelStyle:''; ?> >Your name :</label>\n\t\t\t<input type=\"text\" id=\"name\" name=\"name\" value=\"<?php echo htmlspecialchars($name); ?>\" <?php echo ($style) ? $inputStyle:''; ?>/>\n\n\t\t\t<label for=\"email\" <?php echo ($style) ? $labelStyle:''; ?> >Your email address : </label>\n\t\t\t<input type=\"text\" id=\"email\" name=\"email\" value=\"<?php echo htmlspecialchars($email); ?>\" <?php echo ($style) ? $inputStyle:''; ?>/>\n\n\t\t\t<label for=\"subject\" <?php echo ($style) ? $labelStyle:''; ?> >Subject : </label>\n\t\t\t<input type=\"text\" id=\"subject\" name=\"subject\" value=\"<?php echo htmlspecialchars($subject); ?>\" <?php echo ($style) ? $inputStyle:''; ?>/>\n\n\t\t\t<label for=\"message\" <?php echo ($style) ? $labelStyle:''; ?> >Message : </label>\n\t\t\t<textarea name=\"message\" id=\"message\" <?php echo ($style) ? $taStyle:''; ?>><?php echo $message; ?></textarea>\n\n\t\t <input type=\"submit\" class=\"button\" value=\"Submit\" <?php echo ($style) ? $buttonStyle: ''; ?> /> \n <input class=\"button\" type=\"reset\" value=\"Clear\" <?php echo ($style) ? $buttonStyle: ''; ?> />\n </fieldset>\n\t</form>\n\t<!-- END of CONTACT_FORM -->\n\n<?php\n}", "public function EmailSignupForm() {\n\t\t$fields = new FieldList(array(\n\t\t\t$email = EmailField::create('Email', '')->setAttribute('placeholder', 'Enter your email address'),\n\t\t\t$newsletter = CheckboxField::create('SignUpForNewsletter', 'Keep up to date with changes that affect your business. Sign up to the monthly newsletter.', '1'),\n\t\t\t$redirect = HiddenField::create('RedirectURL', 'RedirectURL')\n\t\t));\n\n\t\tif ($this->CMNotificationList) {\n\t\t\t$label = ($this->NotificationListCheckboxLabel) ? $this->NotificationListCheckboxLabel : 'Sign up for Business Notifications.';\n\t\t\t$notification = CheckboxField::create('SignUpForNotification', $label, '1');\n\t\t\t$fields->push($notification);\n\t\t}\n\n\t\t// Need to include the details about the submission\n\t\t// Because they won't be in the url upon submissions\n\t\t$submission = $this->getSubmission();\n\t\tif ($submission && $submission->exists()) {\n\t\t\t$fields->push(HiddenField::create('SubmissionUID', 'SubmissionUID', $submission->uid));\n\t\t}\n\n\t\t$actions = new FieldList(array(\n\t\t\tFormAction::create('processEmailSignup', 'Email me a link')->setUseButtonTag(true)->addExtraClass('pure-button self-assessment-button')\n\t\t));\n\n\t\t$required = new RequiredFields(array('Email'));\n\n\t\t$form = new Form($this, 'EmailSignupForm', $fields, $actions, $required);\n\n\t\treturn $form;\n\t}", "function ignacio_send_email() {\n}", "public function submitViaEmail($email){\n $to = $email; \n $subject = 'Anmeldung Event';\n $message = $this->printRegistration(); \n $message = wordwrap($message,70); \n $from = 'From: [email protected]'; \n\n mail($to, $subject, $message, $from); \n\n }" ]
[ "0.7050513", "0.6910928", "0.68517417", "0.6681556", "0.6566642", "0.6488", "0.64411634", "0.6423666", "0.64092547", "0.63977534", "0.63587487", "0.6354631", "0.6308949", "0.63017637", "0.6252094", "0.62474406", "0.6243022", "0.6203859", "0.619898", "0.61956984", "0.6188671", "0.6180433", "0.6136679", "0.6118449", "0.61069894", "0.6099668", "0.6089527", "0.6088378", "0.60870826", "0.60744375" ]
0.7224978
0
Email Function Gathers all subscribed newsletter emails and sends them an email with the subject/body from the form.
public function email() { // Load the Email library $this->load->library('email'); // Get all the emails we want to send to. $emails = $this->admin_model->addresses(); // Loop the emails foreach($emails as $email) { $this->email->clear(); // Since we are looping, we'll just clear the fields each time. $this->email->to($email['email']); $this->email->from('[email protected]','TaskManager Staff'); $this->email->subject($this->input->post('subject')); $this->email->message($this->input->post('body')); // Away you go! $this->email->send(); } redirect('admin/newsletter','refresh'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function subscriberMail()\t{\n\t\t\t//Now this sends a mail to all the people in the subscribers list.\n\t\t}", "public function newsletter_send_email_post()\n {\n prevent_editor();\n\n $subject = $this->input->post('subject', true);\n $message = $this->input->post('message', false);\n\n $data['newsletter'] = $this->newsletter_model->get_newsletters();\n\n foreach ($data['newsletter'] as $item) {\n //send email\n $this->settings_model->send_email($item->email, $subject, $message);\n }\n\n $this->session->set_flashdata('success', \"Email sent successfully!\");\n redirect($this->agent->referrer());\n }", "function sitewide_newsletters()\r\n{\r\n\tglobal $current_user, $wpdb;\r\n\t$query_fields = array( 'fields' => array( 'user_login', 'user_email' ) );\r\n\tif ( array_key_exists( \"role\", $_POST ) && trim( $_POST[\"role\"] ) != \"\" ) {\r\n\t\t$query_fields = array( 'fields' => array( 'user_login', 'user_email' ), 'role' => trim( $_POST[\"role\"] ) );\r\n\t}\r\n\t$user_query = new WP_User_Query( $query_fields );\r\n\t$users = $user_query->get_total();\r\n\t\r\n\t$message = \"\";\r\n\r\n\t// if sending a newsletter\r\n\tif ( @$_POST[\"newsletter\"] != \"\" && @$_POST[\"subject\"] != \"\" && @$_POST[\"fromname\"] != \"\" && @$_POST[\"fromemail\"] != \"\" )\r\n\t{\r\n\t\ttry {\r\n\t\r\n\t\t\t$newsletter = stripslashes( trim( $_POST[\"newsletter\"] ) );\r\n\t\t\t$subject = stripslashes( trim( $_POST[\"subject\"] ) );\r\n\t\t\t\r\n\t\t\t$message_headers = 'From: \"' . addslashes($_POST[\"fromname\"]) . '\" <' . addslashes($_POST[\"fromemail\"]) . '>' . \"\\r\\n\" .\r\n\t\t\t'Reply-To: ' . get_site_option(\"admin_email\") . '' . \"\\r\\n\" .\r\n\t\t\t'X-Mailer: PHP/' . phpversion();\r\n\t\t\t\r\n\t\t\t$failed = \"\";\r\n\t\t\t$sent = 0;\r\n\t\t\t\r\n\t\t\tif (@$_POST[\"test\"] == \"\")\r\n\t\t\t{\r\n\t\t\t\r\n\t\t\t\t$user_query = new WP_User_Query( $query_fields );\r\n\t\t\t\t$emails = $user_query->get_results();\r\n\t\t\t\r\n\t\t\t\tforeach ( $emails as $email )\r\n\t\t\t\t{\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\r\n\t\t\t\t\t\t$e = $email->user_email;\r\n\t\t\t\t\t\tif ( wp_mail( $e, $subject, $newsletter, $message_headers ) )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$sent++;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif ( trim( $e ) == \"\" ) {\r\n\t\t\t\t\t\t\t\t$failed .= \"No email address for user \" . $email->user_login . \"\\r\\n\";\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t$failed .= $e . \"\\r\\n\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t} catch (Exception $e) {\r\n\t\t\r\n\t\t\t\t\t\t$failed .= \"Error with \" . $e . \": \" . $e->getMessage() . \"\\r\\n\";\r\n\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t} else {\r\n\r\n\t\t\t\t$email = get_site_option(\"admin_email\");\r\n\t\t\t\r\n\t\t\t\ttry {\r\n\t\t\t\t\r\n\t\t\t\t\tif ( wp_mail( $email, $subject, $newsletter, $message_headers ) ) {\r\n\r\n\t\t\t\t\t\t$sent++;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$failed .= \"Error: test message could not be sent to \" . $email . \"\\r\\n\";\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t} catch (Exception $e) {\r\n\r\n\t\t\t\t\t$failed .= \"Error sending to \" . $email . \": \" . $e->getMessage() . \"\\r\\n\";\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t}\r\n\t\t\t$message = \"<p>Your message has been sent to \" . $sent . \" email addresses (\" . $users . \" users in total).</p>\";\r\n\t\t\tif ($failed != \"\")\r\n\t\t\t{\r\n\t\t\t\t$message .= '<p>Failed addresses:</p><p><textarea cols=\"30\" rows=\"12\" style=\"width: 100%\">' . $failed . '</textarea></p>';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} catch (Exception $e) {\r\n\t\t\r\n\t\t\t$message = \"<p>An error was encountered: \" . $e->getMessage() . \"</p>\";\r\n\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\tprint '\r\n\t<div class=\"wrap\">\r\n\t';\r\n\tsitewide_newsletters_wp_plugin_standard_header( \"GBP\", \"Sitewide Newsletter\", \"Chris Taylor\", \"[email protected]\", \"http://wordpress.org/extend/plugins/sitewide-newsletter/\" );\r\n\tprint '\r\n\t<h2>Sitewide Newsletter</h2>\r\n\t\r\n\t' . $message . '\r\n\t\r\n\t<p>Enter your newsletter below which will be emailed to ' . $users . ' users.</p>\r\n\t\r\n\t<form action=\"users.php?page=sitewide_newsletters\" method=\"post\">\r\n\t\r\n\t\t<fieldset>\r\n\t\t\r\n\t\t<legend>Send a newsletter</legend>\r\n\t\t\r\n\t\t<p><label for=\"fromname\" style=\"float: left;width: 15%;\">From name</label><input type=\"text\" name=\"fromname\" id=\"fromname\" style=\"width: 80%\" value=\"' . get_site_option(\"site_name\") . '\" /></p>\r\n\t\t\r\n\t\t<p><label for=\"fromemail\" style=\"float: left;width: 15%;\">From email</label><input type=\"text\" name=\"fromemail\" id=\"fromemail\" style=\"width: 80%\" value=\"' . get_site_option(\"admin_email\") . '\" /></p>\r\n\t\t\t\r\n\t\t<p><label for=\"subject\" style=\"float: left;width: 15%;\">Subject</label><input type=\"text\" name=\"subject\" id=\"subject\" style=\"width: 80%\" /></p>\r\n\t\t\t\r\n\t\t<p><label for=\"newsletter\" style=\"float: left;width: 15%;\">Newsletter</label><textarea name=\"newsletter\" id=\"newsletter\" cols=\"30\" rows=\"6\" style=\"width: 80%\"></textarea></p>\r\n\t\t\r\n\t\t<p><label for=\"role\" style=\"float: left;width: 15%\">Role</label><select name=\"role\" id=\"role\">\r\n\t\t\t<option value=\"\">All</option>\r\n\t\t';\r\n\t\t$roles = get_editable_roles();\r\n\t\tforeach( $roles as $role ) {\r\n\t\t\tprint '\r\n\t\t\t<option value=\"' . $role[\"name\"] . '\">' . $role[\"name\"] . '</option>\r\n\t\t\t';\r\n\t\t}\r\n\t\tprint '\r\n\t\t</select> Send this newsletter to users with just one role, or to all users</p>\r\n\t\t\r\n\t\t<p><label for=\"subject\" style=\"float: left;width: 15%;\">Test newsletter</label><input type=\"checkbox\" name=\"test\" id=\"test\" /> This will just send the newsletter to ' . get_site_option(\"admin_email\") . '</p>\r\n\t\t\r\n\t\t<p><label for=\"send_sitewide_newsletter\" style=\"float: left;width: 15%;\">Send newsletter</label><input type=\"submit\" name=\"send_sitewide_newsletter\" id=\"send_sitewide_newsletter\" value=\"Send newsletter\" class=\"button\" /></p>\r\n\t\t\r\n\t\t</fieldset>\r\n\r\n\t</form>\r\n\t';\r\n\tsitewide_newsletters_wp_plugin_standard_footer( \"GBP\", \"Sitewide Newsletter\", \"Chris Taylor\", \"[email protected]\", \"http://wordpress.org/extend/plugins/sitewide-newsletter/\" );\r\n\tprint '\r\n\t</div>\r\n\t';\r\n}", "public function form_email()\n\t{\n\t\tif ($this->errstr)\n\t\t{\n\t\t\tFsb::$tpl->set_switch('error_handler');\n\t\t}\n\n\t\t// Liste des groupes\n\t\t$list_groups = Html::list_groups('email_groups[]', GROUP_SPECIAL|GROUP_NORMAL, $this->data['groups'], true, array(GROUP_SPECIAL_VISITOR));\n\n\t\tFsb::$tpl->set_switch('email_mass');\n\t\tFsb::$tpl->set_vars(array(\n\t\t\t'LIST_GROUPS' =>\t\t$list_groups,\n\t\t\t'VALUE_SUBJECT' =>\t\thtmlspecialchars($this->data['subject']),\n\t\t\t'VALUE_USERS' =>\t\thtmlspecialchars($this->data['users']),\n\t\t\t'VALUE_CONTENT' =>\t\thtmlspecialchars($this->data['content']),\n\t\t\t'CONTENT' =>\t\t\tHtml::make_errstr($this->errstr),\n\n\t\t\t'U_ACTION' =>\t\t\tsid('index.' . PHPEXT . '?p=general_email'),\n\t\t));\n\t}", "public function EmailSpeakers() {\n\n\t\t\t$SpeakerSet = SpeakerSubmission::get()->filter(array('BeenEmailed' => 0,'DisplayOnSite' => 1))->sort('BeenEmailed','ASC')->limit(250);\n\n\t\t\t// Iterate through to send an email to each speaker\n\t \tforeach ($SpeakerSet as $item) {\n\n\t \t\tif ($item->BeenEmailed != TRUE && EmailUtils::validEmail($item->Email)) {\n\n\t \t\t\t//Send email to submitter\n\t\t \t\t$To = $item->Email;\n\t\t\t\t\t$Subject = \"Your OpenStack Summit Presentation Submission\"; \n\t\t \t\t$email = EmailFactory::getInstance()->buildEmail(SPEAKER_EMAIL_FROM, $To, $Subject);\n\t\t \t\t$email->setTemplate('SpeakerSubmissionVoterEmail');\n\t\t \t\t$email->populateTemplate($item);\n\t\t \t\t$email->send();\n\n\t\t \t\t// Set flag in DB that this speaker has been emailed\n\t\t \t$item->BeenEmailed = TRUE;\n\t\t\t \t$item->write();\n\t\t\t\t\techo \"Email sent to \" . $item->Email . \"<br/>\";\n\t\t \t}\n\t \t} \n\n\t \treturn \"Speakers emailed successfully.\";\n\n\t\t}", "function newsletter(){\n\t\t$this->form_validation->set_rules('name', '', 'required');\n\t\t$this->form_validation->set_rules('email', '', 'trim|required|valid_email');\n\t\tif($this->form_validation->run() == FALSE){ \n\t\t\techo json_encode(array('data'=>\"All fields are mandatory and email format should be correct.\"));\n\t\t }else{\n\t\t$data['name'] = $this->security->sanitize_filename($this->input->post('name'));\t\t\n\t\t$data['email'] \t= $this->security->sanitize_filename($this->input->post('email'));\t\n\t\t$checkemail = $this->Home_model->checkifemailalreadythere($this->security->xss_clean($data['email']));\t\n\t\tif($checkemail>0){\n\t\t$returndata = $this->Home_model->saveNewsLetter($this->security->xss_clean($data));\n\t\tif($returndata >0)\n\t\t{\t\n\t\t\t$name = $this->security->xss_clean($data['name']);\n\t\t\t$email = $this->security->xss_clean($data['email']);\n\t\t\t$json = json_encode(array(\"email\"=>$email, \"first_name\"=>$name));\n\t\t\t\t\t$curl = curl_init();\n\t\t\t\t\tcurl_setopt_array($curl, array(\n\t\t\t\t\tCURLOPT_URL => \"https://api.sendgrid.com/v3/contactdb/recipients\",\n\t\t\t\t\tCURLOPT_RETURNTRANSFER => true,\n\t\t\t\t\tCURLOPT_ENCODING => \"\",\n\t\t\t\t\tCURLOPT_MAXREDIRS => 10,\n\t\t\t\t\tCURLOPT_TIMEOUT => 30,\n\t\t\t\t\tCURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n\t\t\t\t\tCURLOPT_CUSTOMREQUEST => \"POST\",\n\t\t\t\t\tCURLOPT_POSTFIELDS => \"[\\r\\n $json\\r\\n]\",\n\t\t\t\t CURLOPT_HTTPHEADER => array(\n\t\t\t\t\t \"authorization: Bearer \".SENDGRIDKEY,\n\t\t\t\t\t \"cache-control: no-cache\"\n\t\t\t\t\t ),\n\t\t\t\t\t));\n\t\t\t\t\t$response = curl_exec($curl);\n\t\t\t\t\t$err = curl_error($curl);\n\t\t\t\t\tcurl_close($curl);\n\t\t\t\t\techo json_encode(array('data'=>\"You have successfully subscribed to the newsletter.\"));\n\t\t}else{\n\t\t\techo json_encode(array('data'=>\"Something went wrong!\"));\n\t\t}\t\t\n\t\t}else{\n\t\t\techo json_encode(array('data'=>\"You are already subscribed to the newsletter.\"));\n\t\t}\n\t}//end validation check\n }", "public function mailNewsletter(Newsletter $newsletter, array $subscriptions)\n {\n $data = [\n 'subject' => $newsletter->getSubject(), 'title' => $newsletter->getTitle(),\n 'lead' => $newsletter->getLead(), 'content' => $newsletter->getContent()\n ];\n\n $dataText = array();\n $dataHtml = array();\n\n $content = null;\n foreach ($data as $area => $content) {\n $dataText[$area] = strip_tags($content);\n\n $contentHtml = htmlentities($content);\n\n if ($area == 'content') {\n $contentHtml = str_replace(array(\"\\n\\n\", \"\\r\\r\", \"\\r\\n\\r\\n\"), '</p><p>', $contentHtml);\n }\n\n $dataHtml[$area] = $contentHtml;\n }\n unset($content);\n\n $this->logger->info(\n 'Going to send newsletter {lid} for {count} recipients',\n ['lid' => $newsletter->getLid(), 'count' => count($subscriptions)]\n );\n\n $sentCount = 0;\n $exceptions = [];\n\n /** @var NewsletterSubscription $subscription */\n foreach ($subscriptions as $subscription) {\n $startTime = microtime(true);\n if ($subscription->getIsEnabled() && $subscription->getIsConfirmed()) {\n if ($newsletter->getAgeRangeEnd() === 18 && $subscription->getAgeRangeBegin(true) > 18) {\n $dataHtml['calltoactioncontent'] = sprintf(\n '<p>Dieser Newsletter wurde Ihnen zugestellt, obwohl in Ihrem Abonnement eigentlich eine Altersspanne <i>%1$d bis %2$d Jahre</i> konfiguriert ist. Um auch über Veranstaltungen für jüngere Zielgruppen auf dem Laufenden zu bleiben, sollten Sie ihre abonnierte <a href=\"%3$s\">Altersspanne korrigieren</a> oder das <a href=\"%3$s\">mitwachsen der Altersspanne deaktivieren</a>.</p>\n <p><a href=\"%3$s\">Abonnement verwalten &raquo;</a></p>',\n $subscription->getAgeRangeBegin(true),\n $subscription->getAgeRangeEnd(true),\n $this->urlGenerator->generate(\n 'newsletter_subscription_token', ['token' => $subscription->getDisableToken()],\n UrlGeneratorInterface::ABSOLUTE_URL\n )\n );\n } else {\n $dataHtml['calltoactioncontent'] = null;\n }\n\n $dataBoth = array(\n 'text' => $dataText,\n 'html' => $dataHtml\n );\n $email = $subscription->getEmail();\n $firstName = '';\n $lastName = $subscription->getNameLast();\n $assignedUser = $subscription->getAssignedUser();\n if ($assignedUser) {\n $lastName = $assignedUser->getNameLast();\n $firstName = $assignedUser->getNameFirst();\n }\n\n $message = $this->mailGenerator->getMessage('general-raw', $dataBoth);\n\n if ($assignedUser) {\n $message->setTo(\n $email,\n (User::generateFullname($lastName, $firstName))\n );\n } elseif ($lastName) {\n $message->setTo($email, $lastName);\n } else {\n $message->setTo($email);\n }\n\n $resultCount = 0;\n try {\n $resultCount = $this->mailer->send($message);\n $sentCount += $resultCount;\n $newsletter->addRecipient($subscription);\n } catch (\\Exception $e) {\n $exceptions[] = $e;\n }\n\n $duration = round(microtime(true) - $startTime);\n if ($resultCount) {\n $this->logger->info(\n 'Sent newsletter to {rid} in {duration} seconds',\n ['rid' => $subscription->getRid(), 'duration' => $duration]\n );\n } else {\n $this->logger->error(\n 'Failed to send newsletter to {rid} in {duration} seconds',\n ['rid' => $subscription->getRid(), 'duration' => $duration]\n );\n }\n }\n }\n\n if (count($exceptions)) {\n /** @var \\Exception $exception */\n foreach ($exceptions as $exception) {\n $this->logger->error(\n 'Exception occured while sending in file {file}:{line}: {message}',\n [\n 'file' => $exception->getFile(),\n 'line' => $exception->getLine(),\n 'message' => $exception->getMessage()\n ]\n );\n }\n }\n\n return $sentCount;\n }", "public function newsletter()\n\t{\n\t\t$data['members'] = count($this->admin_model->addresses());\n\t\t$data['pageTitle'] = 'Newsletter Form';\n\t\t$data['mainBlock'] = 'email';\n\t\t$data['modules'] = array('placeholder');\n\t\t$this->load->view('inc/container', $data);\t\t\n\t}", "public static function autosendNewsletter()\n\t{\n\t\t// test si le plugin est actif\n\t\tif (!newsletterPlugin::isActive()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// test si l'envoi automatique est activé\n\t\tif (!newsletterPlugin::getAutosend()) {\n\t\t\treturn;\n\t\t} else {\n\t\t\t$datas = self::getlist(true);\n \tif (!is_object($datas)) {\n \t\treturn;\n \t} else {\n\t\t\t\tglobal $core;\n\t\t \ttry {\n\t\t\t\t\t$datas->moveStart();\n \t\twhile ($datas->fetch()) { \n \t\t\tself::sendNewsletter($datas->subscriber_id); \n \t\t}\n\t\t\t\t} catch (Exception $e) { \n\t\t\t\t\t$core->error->add($e->getMessage()); \n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t} \t\n\t\t}\t\n\t}", "function send($newsletter_id) {\n\t\t\t\n\t\t// # SELECT only retail customers price group who are NOT amazon customers and who ARE subscribed.\n\n\t\t$mail_query = tep_db_query(\"SELECT * \n\t\t\t\t\t\t\t\t\tFROM (SELECT DISTINCT c.customers_email_address, \n\t\t\t\t\t\t\t\t\t\t\tc.customers_id,\n\t\t\t\t\t\t\t\t\t\t\tc.customers_firstname, \n\t\t\t\t\t\t\t\t\t\t\tc.customers_lastname,\n\t\t\t\t\t\t\t\t\t\t\tc.customers_newsletter\n\t\t\t\t\t\t\t\t\t\t\tFROM \" . TABLE_CUSTOMERS . \" c\n\t\t\t\t\t\t\t\t\t\t\tWHERE c.customers_email_address NOT LIKE '%@marketplace.amazon.com'\n\t\t\t\t\t\t\t\t\t\t\tAND c.customers_group_id > 1\n\t\t\t\t\t\t\t\t\t\t\tAND c.customers_newsletter = '1'\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tUNION ALL\n\n\t\t\t\t\t\t\t\t\t\tSELECT DISTINCT s.subscribers_email_address,\n\t\t\t\t\t\t\t\t\t\t\t\ts.customers_id,\n\t\t\t\t\t\t\t\t\t\t\t\ts.subscribers_firstname,\n\t\t\t\t\t\t\t\t\t\t\t\ts.subscribers_lastname,\n\t\t\t\t\t\t\t\t\t\t\t\ts.customers_newsletter\n\t\t\t\t\t\t\t\t\t\tFROM subscribers s\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN \" . TABLE_CUSTOMERS . \" c ON c.customers_email_address = s.subscribers_email_address\n\t\t \t\t\t\t\t\t\t\tWHERE c.customers_email_address IS NULL\n\t\t \t\t\t\t\t\t\t\tAND s.customers_newsletter = '1'\n\t\t\t\t\t\t\t\t\t\tAND s.source_import = 'vendors_subscribers') AS table1\n\t\t\t\t\t\t\t\t\t\");\n\n\n\t\t$known_domains = array('gmail.com', 'yahoo.com', 'hotmail.com', 'aol.com');\n\n\t\twhile ($mail = tep_db_fetch_array($mail_query)) {\n\n\t\t\t$ok_insert = false;\n\n\t\t\tpreg_match('/@(.*)/', $mail['customers_email_address'], $domain);\n\n\t\t\tif(in_array($domain[1], $known_domains)) {\n\t\t\t\t$ok_insert = true;\n\t\t\t} else {\n\t\t\t\tif(checkdnsrr($domain[1], \"MX\")) { \n\t\t\t\t\t$ok_insert = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\n\t\t\tif($ok_insert) { \n\t\t\t\t\n\t\t\t\t$known_domains[] = $domain[1];\n\n\t\t\t\t// # routine for adding appropriate user select into newsletter_queue table of database.\n\t\t\t\ttep_db_query(\"INSERT IGNORE INTO newsletter_queue \n\t\t\t\t\t\t\t SET newsletters_id = '\".(int)$newsletter_id.\"',\n\t\t\t\t\t\t\t user_id = '\".(!empty($mail['customers_id']) ? $mail['customers_id'] : '0').\"',\n\t\t\t\t\t\t\t firstname = '\".mysql_real_escape_string($mail['customers_firstname']).\"',\n\t\t\t\t\t\t\t lastname = '\".mysql_real_escape_string($mail['customers_lastname']).\"',\n\t\t\t\t\t\t\t email = '\".$mail['customers_email_address'].\"',\n\t\t\t\t\t\t\t updated = NOW(),\n\t\t\t\t\t\t\t status = 'pending'\n\t\t\t\t\t\t\t\");\n\t\t\t}\n\n\t\t}\n\t}", "function email_blast() {\n\t\t$date = date('Y-m-d H:i:s');\t//store current date for caching/speed\n\t\t\n\t\t$emailsToSend = array();\t\t//empty array that will hold the details for all emails to send\n\t\t$this->autoRender = false;\n\t\t\n\t\t//get all subscribers\n\t\t$subs = $this->DealAlert->query(\"SELECT DealAlert.*, User.email, User.userId, User.firstName, User.lastName FROM dealAlert AS DealAlert\n\t\t\t\t\t\t\t\t\t\tINNER JOIN user AS User USING(userId)\");\t\t\n\t\t\n\t\t/**\n\t\t * For each subscriber, we need to find the deals that pertain to them\n\t\t */\n\t\tforeach ($subs as $sub) {\n\n\t\t\t$clientId = $sub['DealAlert']['clientId'];\n\t\t\t\n\t\t\t//this query just looks in live offer for any new auctions/buy nows\n\t\t\t//the rules state that anything that hasn't been up for the last 30 days is considered 'new'\n\n\t\t\tswitch ($sub['DealAlert']['siteId']) {\n\t\t\t\tcase 1:\n\t\t\t\t\t$offerSite = 'offerLuxuryLink';\n\t\t\t\t\t$siteUrl = 'http://www.luxurylink.com';\n\t\t\t\t\t$siteId = 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\t$offerSite = 'offerFamily';\n\t\t\t\t\t$siteUrl = 'http://www.familygetaway.com';\n\t\t\t\t\t$siteId = 2;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$tmpNew = $this->DealAlert->query(\"SELECT DISTINCT(OfferLive.packageId), Client.name, OfferLive.shortBlurb,\n\t\t\t\t\t\t\t\t\t\t\t\t\tClient.clientId,\n\t\t\t\t\t\t\t\t\t\t\t\t\toldProductId,\n\t\t\t\t\t\t\t\t\t\t\t\t\tseoName,\n\t\t\t\t\t \t\t\t\t\t\t\t\tClient.locationDisplay\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM $offerSite AS OfferLive \n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN clientLoaPackageRel cl USING(packageId)\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN client AS Client ON(Client.clientId = $clientId)\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN $offerSite AS OfferLivePrev ON (OfferLivePrev.startDate <= ('{$sub['DealAlert']['lastActionDate']}' - INTERVAL 5 MINUTE) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND OfferLivePrev.endDate >= ('{$sub['DealAlert']['lastActionDate']}' - INTERVAL 30 DAY) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND OfferLivePrev.endDate >= '{$sub['DealAlert']['subscribeDate']}' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND OfferLivePrev.packageId = OfferLive.packageId \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND OfferLivePrev.isMystery = 0) \n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE cl.clientId = $clientId\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND OfferLivePrev.offerId IS NULL \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND OfferLive.startDate BETWEEN ('{$sub['DealAlert']['lastActionDate']}' - INTERVAL 5 MINUTE) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND '{$sub['DealAlert']['lastActionDate']}' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND OfferLive.isMystery = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tGROUP BY OfferLive.packageId\");\n\t\t\t\n\t\t\tif (empty($tmpNew) || !is_array($tmpNew)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t//create a nice array of all new packages\n\t\t\t$tmp = array();\n\t\t\tforeach ($tmpNew as $pkg) {\n\t\t\t\t$tmp[] = array('packageId' => $pkg['OfferLive']['packageId'],\n\t\t\t\t\t\t\t\t'clientName' => $pkg['Client']['name'],\n\t\t\t\t\t\t\t\t'clientUrl' => \"$siteUrl/luxury-hotels/\".$pkg['Client']['seoName'].\"?clid=\".$pkg['Client']['clientId'],\n\t\t\t\t\t\t\t\t'shortBlurb' => $pkg['OfferLive']['shortBlurb'],\n\t\t\t\t\t\t\t\t'oldProductId' => $pkg['Client']['oldProductId'],\n\t\t\t\t\t\t\t\t'seoName' => $pkg['Client']['seoName'],\n\t\t\t\t\t\t\t\t'clientId' => $pkg['Client']['clientId'],\n\t\t\t\t\t\t\t\t'siteId' => $siteId, \n\t\t\t\t\t\t\t\t'locationDisplay' => $pkg['CLient']['locationDisplay']);\n\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t//if any new packages were found, it means we need to send the user an email\n\t\t\t//store all of this in an easy array\n\t\t\tif (!empty($tmp)) {\n\t\t\t\t$emailsToSend[$sub['DealAlert']['userId']] = array('email' => $sub['User']['email'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'firstName' => $sub['User']['firstName'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'lastName' => $sub['User']['lastName'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'userId' => $sub['User']['userId'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'packages' => array_merge((array)$emailsToSend[$sub['DealAlert']['userId']]['packages'], (array)$tmp));\n\n\t\t\t\t$this->DealAlert->query(\"UPDATE dealAlert SET lastActionDate = '$date', lastAction = 'EMAIL' WHERE clientId = {$clientId}\");\n\t\t\t}\n\t\t}\n\t\t\n\n\t\t//loop through all users and for each new package we send them an email with package details\n\t\tforeach ($emailsToSend as $k => $v) {\n\t\t\tforeach ($v['packages'] as $k2 => $v2) {\n\t\t\t\t$this->mail($v['email'], $v['firstName'], $v['lastName'], $v['userId'], $v2);\n\t\t\t}\n\t\t}\n\n\t}", "public static function updateEmail() {\n\t\tif(isset($_POST['update'])) {\n\t\t\tif (isset($_POST['email-new'])) {\n\t\t\t\t$newEmail = new Newsletter([\n\t\t\t\t\t'email' => htmlspecialchars($_POST['email-new']),\n\t\t\t\t\t'id' => htmlspecialchars($_GET['id'])\n\t\t\t\t]);\n\n\t\t\t\t$newEmailManager = new NewsletterManager();\n\t\t\t\t$updateEmail = $newEmailManager->update($newEmail);\n\t\t\t\theader('Location: admin.php?page=adminNewsletterView'); \n\t\t\t\texit();\n\t\t\t}\n\t\t}\n\t}", "public function suscribe(){\n\t\t$email = $_POST['email'];\n\n\t\t//$avail = $this->enmodel->liketable(\"suscribe\",$email);\n\t\t$avail = $this->enmodel->getWhere(\"newsuscribe\",\"emailid\",$email);\n\t\t//print_r($avail);\n\t\t//print_r($avail[0]['emailid']);\n\t\tif(!empty($avail))\n\t\t{\n\t\t\t$data = array(\n\t\t\t\t\t\t\"val\" => 1\n\t\t\t\t\t);\n\t\t\t\n\t\t\t$message = $this->load->view(\"email/suscribe.php\",$data, TRUE);\n\t\t\t$to = $email;\n\t $subject = 'Do not reply email';\n\t $this->suscribeMail($to,$subject, $message);\n\t $this->load->view(\"Home/page1\",$data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$data = array(\n\t\t\t\t\"emailid\" => $email,\n\t\t\t);\n\t\t\t$test = $this->enmodel->add(\"newsuscribe\",$data);\n\t\t\t//echo $test;exit;\n\t\t\t$data = array(\n\t\t\t\t\t\t\"val\" => 0\n\t\t\t\t\t);\n\t\t\t$this->load->view(\"Home/page1\",$data);\n\t\t}\n\n\n\t\t// PHP Mailer Required\n\t\t//require_once(APPPATH.'third_party/phpmailer/class.phpmailer.php');\n\t\t// Create a Array For save data enquiryform table\n\t\t/*$data = array(\n\t\t\t\t\"email\" => $email\n\t\t\t);\n\t\t// Save Data in enquiry form table and return enquiry id\n\t\t$this->enmodel->add(\"suscribe\",$data);\n*/\n\t\t// SMTP MAIL SYSTM FOR CUSTOMER\n\t\t\t/*$mail = new PHPMailer();\n\t\t\t$mail->IsSMTP();\n\t\t\t$mail->SMTPDebug = 0;\n\t\t\t$mail->SMTPAuth = true;\n\t\t\t$mail->SMTPSecure = \"ssl\";\n\t\t\t$mail->Port = 465;\n\t\t\t$mail->Host = \"smtp.gmail.com\";\n\t\t\t$mail->Username = \"[email protected]\";\n\t\t\t$mail->Password = \"xxxxxx\";\n\t\t\t$mail->Mailer = \"smtp\";\n\t\t\t//Send EMAIL\n\t\t\t$mail->SetFrom($email);\n\t\t\t//$mail->SetFrom(\"[email protected]\", $_POST[\"name\"]);\n\t\t\t$mail->AddReplyTo($email);\n\t\t\t$mail->AddAddress($email);\n\t\t\t$mail->Subject = \"Suscribe\";\n\t\t\t$mail->WordWrap = 80;\n\t\t\t$message = \"Thankyou for suscribe\";\n\t\t\t//$mail->MsgHTML($_POST[\"content\"]);\n\t\t\t$mail->MsgHTML($message);\n\t\t\t$mail->Body = $this->load->view(\"email/suscribe.php\",$data, TRUE);\n\t\t\t//$mail->IsHTML(true);\n\t\t\t$mail->IsHTML(true);\n\t\t\tif(!$mail->Send()) {\n\t\t\t\t$this->load->view(\"Home/page1\");\n\t\t\t} else {\n\n\t\t\t\t$this->load->view(\"Home/page1\");\n\t\t\t}*/\n\t}", "public function indexAction()\n {\n $collectionarray = Mage::getResourceModel('newsletter/subscriber_collection')->showStoreInfo()\n ->showCustomerInfo()\n ->useOnlySubscribed()\n ->toArray()\n ;\n\n if ($collectionarray['totalRecords'] > 0) {\n Mage::getSingleton('emailplatform/emailplatform')->batchSubscribe($collectionarray['items']);\n }\n\n $this->_redirect('adminhtml/newsletter_subscriber/');\n }", "protected function makeEmails()\n {\n }", "public function newsletterSubscriptions($user_email, $settings)\n {\n $api_key = \"8355d50813ef16722e53a6613eee8cf3-us15\"; \n $list_id = \"a386debcfb\";\n $name = \"\";\n $email = $user_email;\n $phone = \"\";\n $args=array(\"apikey\" =>$api_key, \"id\" => $list_id, \"email\" => array(\"email\" => $email));\n $MailChimp = new \\MailChimp($api_key);\n $result = $MailChimp->call(\"lists/subscribe\",$args);\n if($result){\n return true;\n }else{\n return false;\n }\n /*$admin_email = self::getAdminEmail(['mail_email','contact_email']);\n $email = new Email();\n $email->to(array($user_email));\n $email->subject('LearnerOn Newsletter Subscriptions');\n $email->from(array($admin_email->mail_email => WEBSITE_NAME));\n $email->emailFormat('html'); \n $email->template('newsletter_subscriptions_user',Null);\n $email->viewVars(array('url'=>Router::url(\"/\",true),'settings'=>$settings));\n if($email->send()){\n return true;\n }else{\n return false;\n }*/\n }", "function ignacio_send_email() {\n}", "public function send_allmail()\r\n{\r\n\t$contactObj = new ContactClass();\t\r\n\t//fetch mail content and subject\r\n\t$sql2 = $this -> db -> row(\"SELECT * FROM newslettertopic WHERE status='Y'\");\r\n\t$sql = \"SELECT * FROM newsletter where status = 'Y'\";\r\n\t$exec_sql = $this -> db -> query($sql) or die(mysql_error());\r\n //$tot=mysql_affected_rows();\r\n\tif($exec_sql > 0)\r\n\t{\r\n\t\tforeach($exec_sql as $user)\r\n\t\t{\r\n\t\t\t$from_address = ADMINMAIL;\r\n\t\t $to_address = $user[\"email\"];\r\n\t\t\t$subject = $sql2['news_letter_topic_title'];\t\r\n\t\t\t$contents = $sql2['news_letter_topic'];\r\n\t\t\t$contactObj -> sendSimpleMail($to_address,$subject,$contents);\t\t\t\r\n\t } \t\t\r\n\t\t$GLOBALS['err_msg']=\"Mail Sent Successfully.\";\r\n\t\tmain();\r\n\t}\r\n\telse\r\n\t{\r\n\t\t$GLOBALS['err_msg']=\"There are no such guru(s) to send mail.\";\r\n\t\tmain();\r\n\t}\r\n}", "function compose_mail()\n\t{\n\t\t$from = $title = $message = $email = '';\n\n\t\t$message = __('Message from page: ').$this->page.\"\\n\";\n\t\tforeach ($this->form as $key => $value)\n\t\t{\n\t\t\t$message .= $key.' = '.$value.\"\\n\";\n\t\t}\n\n\t\t// reserved words\n\t\tif (isset($this->form['email']) != '') \t{ $email .= $this->form['email'].' ';\t}\n\t\tif (isset($this->form['name']) != '') \t{ $from .= $this->form['name'].' ';\t}\n\t\tif (isset($this->form['title']) != '')\t{ $title .= $this->form['title'].' ';\t}\n\n\t\tif ((get_option('wordpress_api_key') != '') AND (file_exists('/wp-content/plugins/fcc/akismet.php'))) return $this->akismet_sendmail($message,$from,$email,$title);\n\t\telse return $this->sendmail($message,$from,$email,$title);\n\n\t}", "public function post_create(){\n\n\t\t$latestproperties = DB::table('properties')\n\t\t\t->where('property_isDeleted', '!=', '1')\n\t\t\t->where('property_isActive', '1')\n\t\t\t->where('property_statusId', Property::getForSaleId())\n\t\t\t->orderBy('property_id','desc')->take(10)->get();\n\n\t\t$activecustomers = DB::table('customers')->where('customer_isDeleted', '!=', '1')\n\t\t\t\t\t\t\t\t\t\t\t\t ->orderBy('customer_firstName')->get();\t\t\n\n\t\t$alllocations = DB::table('locations')->orderBy('location_name')->get();\n\t\t$allpropertytypes = DB::table('property_types')->orderBy('property_type_name')->get();\n\t\t$allpropertystatuses = DB::table('property_statuses')->orderBy('property_status_name')->get();\n\n\t\tif($activecustomers!=null) {\n\n \tforeach($activecustomers as $customer) {\n\t\t\t\t\n\t\t\t\t$customer_firstName = $customer->customer_firstName;\n\t\t\t\t$customer_lastName = $customer->customer_lastName;\n\t\t\t\t$customer_emailAddress = $customer->customer_emailAddress;\n\n\t\t\t\t$emaildata = array(\n\t\t\t\t\t'latestproperties'=>$latestproperties,\n\t\t\t\t\t'propertylocations'=>$alllocations,\n\t\t\t\t\t'propertystatuses'=>$allpropertystatuses,\n\t\t\t\t\t'propertytypes'=>$allpropertytypes,\n\t\t\t\t\t'customer_firstName'=>$customer_firstName,\n\t\t\t\t\t'customer_lastName'=>$customer_lastName,\n\t\t\t\t\t'customer_emailAddress'=>$customer_emailAddress\n\t\t\t\t);\n\n\t\t\t\tMail::queue('newsletter.email', $emaildata, function($message) \n\t\t\t\t\tuse ($latestproperties, $alllocations, $allpropertystatuses, $allpropertytypes, \n\t\t\t\t\t\t$customer, $customer_firstName, $customer_lastName, $customer_emailAddress){\n\t\t\t \t \t$message->to($customer_emailAddress, $customer_firstName.' '.$customer_lastName)\n\t\t\t \t \t\t->subject('Weekly Email Newsletter');\n\t\t\t \t});\n\t\t\t}\n\n\t\t \treturn Redirect::route('imshome')\n\t\t\t\t->with('message', 'The newsletter was successfully sent!');\n\t\t}\n\n\t\telse\n\t\t \treturn Redirect::route('imshome')\n\t\t\t\t->with('error-message', 'No customers are currently available!');\n\t}", "function enviarmail() {\n $this->datos->agregar(\"sent\",\"Enviado\");\n $titulo=$_POST[\"titulo\"];\n $descripcion=$_POST[\"descripcion\"];\n //enviar correo\n $bd=new MantixOaD();\n $res=$bd->ejecutar(\"select email from can_news where estado=1\");\n while($fila=mysql_fetch_row($res)) {\n $correo=$fila[0];\n $resultado=$this->general_enviarmail($this->de,$correo,\"Cantartica - \".$titulo,$descripcion);\n }\n }", "public function getNewslettersEmail()\n {\n $emails = array();\n\n foreach ($this->getContacts() as $contact) {\n if ($contact->getType() !== ContactInterface::TYPE_NEWSLETTER) {\n continue;\n }\n\n if(!\\in_array($email = $contact->getEmail(), $emails, true)){\n $emails[] = $email;\n }\n }\n\n return $emails;\n }", "function subscribe()\n\t{\n\t\t$obj_subscriber \t\t=& model::create('subscriber', null, $this->module_paths['models']);\n\t\t$obj_newsletter_list \t=& model::create('newsletter_list', null, $this->module_paths['models']);\n\t\t\n\t\tif(isset($_POST['subscribe']))\n\t\t{\n\t\t\t$obj_subscriber->set_field_values_from_array($this->params['subscriber']);\n\t\t\t\n\t\t\tif($obj_subscriber->save())\n\t\t\t{\n\t\t\t\tif(!empty($this->params['newsletter_list']))\n\t\t\t\t\t$obj_subscriber->subscribe_to_lists($this->params['newsletter_list']);\n\t\t\t\telse\n\t\t\t\t\t$obj_subscriber->subscribe_to_all_lists();\n\t\t\t\t\n\t\t\t\t$this->flash['notice'][] = 'You have been subscribed to our newsletters';\n\t\t\t\t$this->redirect_to('newsletters','subscribed');\n\t\t\t}\n\t\t\telse\n\t\t\t\t$this->flash['error'] = $obj_subscriber->_errors;\n\t\t}\n\t\t\t\n\t\t$this->template_data['subscriber'] \t= $obj_subscriber->fields_as_associative_array();\n\t\t$this->template_data['lists'] \t\t= $obj_newsletter_list->find_all(array('where' => 'is_active = 1'));\n\t\t\t\n\t\t$this->breadcrumb[] = array('newsletters/subscribe' => 'Subscribe');\n\t}", "public static function getListEmails() {\n\t\t$newsletter = new NewsletterManager();\n\t\t$getEmails = $newsletter->getListEmail();\n\t\trequire 'view/back/adminNewsletterView.php';\n\t}", "function send(){\n\t\t$this->load->library('form_validation');\n\t\t\n\t\t//params: field name, error message, validation rules\n\t\t$this->form_validation->set_rules('name', 'Name', 'trim|required');\n\t\t$this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');\n\t\t//End of form validation\n\t\t\n\t\t//call run method\n\t\tif($this->form_validation->run() == FALSE){\n\t\t\t//reload it\n\t\t\t$this->load->view('newsletter');\n\t\t}else{\n\t\t\t//validation has passed. Now send the email\n\t\t\t$name = $this->input->post('name');\n\t\t\t$email = $this->input->post('email');\n\t\t\t\n\t\t\t//send email\n\t\t\t\t\t$this->load->library('email'); // removed config \n\t\t\t$this->email->set_newline(\"\\r\\n\");\n\t\t\t\n\t\t\t$this->email->from('[email protected]', 'Phil Walker');\n\t\t\t$this->email->to($email);\n\t\t\t$this->email->subject('Hey phil, your on your way to becoming a PHP developer!');\n\t\t\t$this->email->message('Program 3 hours every day and you will become the best!');\n\t\n\t\t\t//item means grab from file\n\t\t\t//$path = $this->config->item('server_root');\n\t\t\t//points directly to file to attach\n\t\t\t$file = base_URL() . '/attachments/newsletter1.txt';\n\t\n\t\t\t//attach to email\n\t\t\t$this->email->attach($file);\n\t\t\t\n\t\t\t//Confirm if sent\n\t\t\tif($this->email->send()){\n\t\t\t\t//echo 'Your email was sent.';\n\t\t\t\t$this->load->view('signup_confirmation_view');\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\tshow_error($this->email->print_debugger());\n\t\t\t}\t\n\t\t}\n\n\t}", "public function mailInvoice($invoiceId, array $emails);", "private function TestEmail($inputs)\n {\n\n $rc = 'Sending Testmail : succesful';\n\n $emailAdress = $inputs['emailAdress'];\n\n\n // Get last entry ( newsletter ) in Table messages\n\n $latestNewsletter = DB::table('messages')->orderBy('ID', 'desc')->first();\n\n try {\n\n Mail::send('auth.emails.newsletter', ['head' => $latestNewsletter->head, 'content' => $latestNewsletter->content, 'date' => $latestNewsletter->date, 'customer' => 'Schulz'], function ($message) use ($emailAdress) {\n\n $email = $emailAdress;\n $message->to($email, 'TOMBAR')->subject('Test Newsletter');\n\n });\n\n }\n catch (\\Exception $e){\n\n $rc = 'Error sending TestMail : check EmailAdress';\n\n $rc = $e->getMessage();\n\n\n }\n\n return $rc;\n\n\n }", "function sendEmailToAll($subject,$message){\n\t\t$emails=$this->getAllUserEmails();\n\t\tfor($a=0;count($emails)>$a;$a++){\n\t\t\t$this->sendEmail($emails[$a],$subject,$message);\n\t\t\t\n\t\t}\n\t\t \n\t }", "private function subscribeToNewsletter($email) {\n\t\t$apiKey = SiteConfig::current_site_config()->CampaignMonitorAPIKey;\n\t\t$resources = new CMResources($apiKey);\n\n\t\tif($resources\n\t\t\t&& $this->CMDefaultList\n\t\t\t&& $list = $resources->getList($this->CMDefaultList)\n\t\t){\n\t\t\t// Create subscriber\n\t\t\t$fields = array(\n\t\t\t\t'EmailAddress' => $email,\n\t\t\t\t'Resubscribe' => true,\n\t\t\t\t'RestartSubscriptionBasedAutoresponders' => true\n\t\t\t);\n\n\t\t\t$subscriber = new CMSubscriber(null, $fields, $list);\n\t\t\t$subscriber->setCustomFields(array('Source' => $this->data()->Title));\n\t\t\t$subscriber->Save();\n\t\t}\n\t}", "function subscribe_newsletter()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\t\r\n\t\t\t$s_name = trim($this->input->post('s_name'));\r\n\t\t\t$s_email = $this->input->post('s_email');\r\n\t\t\t\r\n\t\t\t$s_tablename = $this->db->NEWSLETTERSUBCRIPTION;\r\n\t\t\t$s_where = \" WHERE s_email = '\".$s_email.\"' \";\r\n\t\t\t$i_count = $this->mod_common->common_count_rows($s_tablename,$s_where);\r\n\t\t\t\r\n\t\t\tif($i_count > 0)\r\n\t\t\t{\t\r\n\t\t\t\t$msg = '2|'.$this->cls_msg[\"subscribe_exist_err\"];\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t$info \t\t\t\t\t= array();\r\n\t\t\t\t$info[\"s_name\"]\t\t\t= $s_name;\r\n\t\t\t\t$info[\"s_email\"]\t\t= $s_email;\r\n\t\t\t\t$info[\"dt_created_on\"]\t= time();\r\n\t\t\t\t$info[\"i_failure_count\"]= 0;\r\n\t\t\t\t\r\n\t\t\t\t$i_newid = $this->mod_common->common_add_info($s_tablename,$info);\r\n\t\t\t\tif($i_newid)////saved successfully\r\n\t\t\t\t{\r\n\t\t\t\t\t$msg = '1|'.$this->cls_msg[\"subscribe_succ\"];\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse ///Not saved,\r\n\t\t\t\t{\r\n\t\t\t\t\t$msg = '2|'.$this->cls_msg[\"subscribe_err\"];\r\n\t\t\t\t}\r\n\t\t\t}\t\t\t\r\n\t\t\t\r\n\t\t\techo $msg;\r\n\t\t\t\r\n\t\t}\r\n\t\tcatch(Exception $err_obj)\r\n {\r\n show_error($err_obj->getMessage());\r\n } \r\n\t}" ]
[ "0.7200137", "0.6941873", "0.65815425", "0.6456485", "0.6416977", "0.63875306", "0.62767845", "0.62081987", "0.61831605", "0.6170501", "0.6117879", "0.6107951", "0.6076217", "0.6026718", "0.5982154", "0.5967377", "0.59453887", "0.59312266", "0.5895652", "0.5886184", "0.58836526", "0.58813506", "0.5865913", "0.5849667", "0.58349425", "0.5812983", "0.58039117", "0.57819617", "0.574882", "0.5746036" ]
0.72012246
0
Get the contents of the remote asset.
public function getContents() { if($this->_contents === null) { $response = $this->_sendClientRequest(); if ($response->isSuccessful()) { $this->_contents = $response->getBody(true); } else { throw new Exception('Minimee could not get remote asset: ' . $this->filenameUrl); } } return $this->_contents;; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function getContents()\n {\n return $this->engine->get($this->path, $this->gatherData());\n }", "protected static function getRemoteContent($url)\n {\n if (function_exists('curl_version'))\n {\n // use (faster) curl if available\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_AUTOREFERER, true);\n curl_setopt($ch, CURLOPT_HEADER, 0);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n\n $data = curl_exec($ch);\n curl_close($ch);\n return $data;\n }\n else\n {\n // fallback to native method if curl not available\n return file_get_contents($url);\n }\n }", "public function get_contents()\r\n {\r\n return $this->_contents;\r\n }", "public function getContents()\n {\n return stream_get_contents($this->stream, $this->maxLength, $this->offset);\n }", "public function get()\n {\n return $this->storedFile->get_content();\n }", "public function getContent() {\n return file_get_contents($this->path);\n }", "public function getContent()\n {\n return $this->filesystem->get($this->path);\n }", "public function readFromRemote($url)\n {\n $source = $this->getHttpClient()->get($url)->getBody()->getContents();\n return parent::read($source);\n }", "abstract public function get_remote_data();", "public function getContents() { return $this->contents; }", "public function getRemote($path)\n {\n return file_get_contents($path);\n }", "public function getContents(): string\n\t{\n\t\t$this->seek(0);\n\n\t\treturn stream_get_contents($this->handle);\n\t}", "public function getContents()\n {\n return $this->contents;\n }", "public function getContents()\n {\n return $this->contents;\n }", "public function getContents()\n {\n return $this->contents;\n }", "public function getContents()\n {\n return $this->contents;\n }", "public function getContents()\n {\n return $this->contents;\n }", "public function get ()\n\t{\n\t\treturn file_get_contents($this->filename);\n\t}", "public function getContent() {\n\t\treturn file_get_contents($this->filename);\n\t}", "public function getContents() {\n return $this->contents;\n }", "public static function get_contents( $url ) {\n\t\t\t$cache_key = md5( $url );\n\t\t\t$result = self::get_cache( $cache_key );\n\t\t\tif ( ! $result ) {\n\t\t\t\t$response = wp_remote_get( $url );\n\t\t\t\tif ( is_array( $response ) ) {\n\t\t\t\t\tself::set_cache( $cache_key, $response['body'] );\n\t\t\t\t\treturn $response['body'];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn $result;\n\t\t}", "public function getContents() {\n\t\treturn $this->contents;\n\t}", "public function getContent()\r\n {\r\n if ($this->exists && $this->content === null) {\r\n $this->content = file_get_contents($this->fullName);\r\n }\r\n\r\n return $this->content;\r\n }", "public function get_contents() {\r\n $data = '';\r\n //GET /repos/:owner/:repo/contents/:path\r\n if (!empty($this->repository)) {\r\n $data_content = $this->get_response('repos/' . $this->username . '/' . $this->repository . '/contents/' . $this->contents);\r\n if ($data_content == TRUE) {\r\n //Wordpress strip php tags -- what's the solution ?\r\n $data = json_decode($data_content);\r\n //trim php tags\r\n $data_code = str_replace('<?php', '', base64_decode($data->content));\r\n $data_code = str_replace('?>', '', $data_code);\r\n $data_code = base64_encode($data_code);\r\n $data->content = $data_code;\r\n }\r\n }\r\n return $data;\r\n }", "public function getData() {\n //get the data from the url\n $rawdata = file_get_contents($this->url);\n\n return $rawdata;\n }", "public function getContents()\n\t{\n\t\treturn $this->contents;\n\t}", "public function getContents()\n\t{\n\t\treturn $this->contents;\n\t}", "public function getContents()\n {\n if (file_exists($this->name) == true) {\n return file_get_contents($this->name);\n }\n \n return '';\n }", "public function content() {\n $out = '';\n\n // XXX: The addition of the Content-Length check is a workaround\n // for an issue with using PHP Stream Wrappers to communicate with\n // Identity Service. Apparently, the remote does not provide\n // an EOF marker, and PHP is too dumb to truncate at Content-Length,\n // so we have to do it manually.\n $max = $this->header('Content-Length', NULL);\n if (isset($this->metadata['unread_bytes']) && isset($max)) {\n while (!feof($this->handle) && strlen($out) < $max) {\n $out .= fread($this->handle, 8192);\n }\n }\n else {\n // XXX: This works fine with CURL, but will not\n // work with PHP HTTP Stream Wrapper b/c the\n // wrapper has a bug that will cause this to\n // hang.\n $out = stream_get_contents($this->handle);\n }\n\n // Should we close or rewind?\n // Cannot rewind PHP HTTP streams.\n fclose($this->handle);\n //rewind($this->handle);\n\n return $out;\n }", "static function getRemoteUrlContent($url, $username = null, $password = null) {\r\n if (function_exists('curl_init')) {\r\n $ch = curl_init();\r\n if (!is_null($username) && !is_null($password))\r\n curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Basic ' . base64_encode(\"$username:$password\")));\r\n curl_setopt($ch, CURLOPT_URL, $url);\r\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);\r\n curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);\r\n curl_setopt($ch, CURLOPT_HEADER, false);\r\n $html = curl_exec($ch);\r\n curl_close($ch);\r\n if (strlen($html)) {\r\n return $html;\r\n }\r\n }\r\n\r\n if (ini_get('allow_url_fopen') == true) {\r\n if (!is_null($username) && !is_null($password))\r\n $url = str_replace(\"://\", \"://$username:$password@\", $url);\r\n $html = file_get_contents($url);\r\n if (strlen($html)) {\r\n return $html;\r\n }\r\n }\r\n\r\n // cannot open url, either install curl-php or set allow_url_fopen = true in php.ini\r\n return false;\r\n }" ]
[ "0.71034205", "0.6935027", "0.6844365", "0.6736379", "0.65780336", "0.6554381", "0.6550726", "0.64748925", "0.6440892", "0.63817203", "0.63738555", "0.63669485", "0.6359036", "0.6359036", "0.6359036", "0.6359036", "0.6359036", "0.63315374", "0.6330332", "0.6316112", "0.63112146", "0.630331", "0.6278303", "0.6260176", "0.6257486", "0.6248505", "0.6248505", "0.6233238", "0.6221945", "0.617502" ]
0.8238337
0
Returns the filename URL with a valid protocol cURL can't (yet?) handle protocol relative URLs, so we match the session and use a secure or unsecure protocol to fetch the remote URLs contents.
public function getFilenameUrlWithProtocol() { if(stripos($this->filenameUrl, 'http') !== 0) { $protocol = craft()->request->isSecureConnection() ? 'https:' : 'http:'; return $protocol . $this->filenameUrl; } else { return $this->filenameUrl; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getFileUrl() {\n return $this->scheme . '://' . $this->url . '/' . $this->fid;\n }", "function remote_file_exists($url, $check_remote = CHECK_REMOTE_FILES) {\n if (!$check_remote || !CHECK_REMOTE_FILES) {\n return true;\n }\n $url = trim($url);\n if (!preg_match(\"=://=\", $url))\n $url = \"http://$url\";\n if (!($url = @parse_url($url))) {\n return false;\n }\n if (!eregi(\"http\", $url['scheme'])) {\n return false;\n }\n $url['port'] = (!isset($url['port'])) ? 80 : $url['port'];\n $url['path'] = (!isset($url['path'])) ? \"/\" : $url['path'];\n $fp = fsockopen($url['host'], $url['port'], $errno, $errstr, 30);\n if (!$fp) {\n return false;\n } else {\n $head = \"\";\n $httpRequest = \"HEAD \" . $url['path'] . \" HTTP/1.1\\r\\n\"\n . \"HOST: \" . $url['host'] . \"\\r\\n\"\n . \"Connection: close\\r\\n\\r\\n\";\n fputs($fp, $httpRequest);\n while (!feof($fp)) {\n $head .= fgets($fp, 1024);\n }\n fclose($fp);\n\n preg_match(\"=^(HTTP/\\d+\\.\\d+) (\\d{3}) ([^\\r\\n]*)=\", $head, $matches);\n if ($matches[2] == 200) {\n return true;\n }\n }\n}", "public function getURL() {\n\n\t\tif (!$this->file instanceof \\ElggFile || !$this->file->exists()) {\n\t\t\telgg_log(\"Unable to resolve resource URL for a file that does not exist on filestore\");\n\t\t\treturn false;\n\t\t}\n\n\t\t$relative_path = '';\n\t\t$root_prefix = _elgg_services()->config->get('dataroot');\n\t\t$path = $this->file->getFilenameOnFilestore();\n\t\tif (substr($path, 0, strlen($root_prefix)) == $root_prefix) {\n\t\t\t$relative_path = substr($path, strlen($root_prefix));\n\t\t}\n\n\t\tif (!$relative_path) {\n\t\t\telgg_log(\"Unable to resolve relative path of the file on the filestore\");\n\t\t\treturn false;\n\t\t}\n\n\t\t$data = array(\n\t\t\t'expires' => isset($this->expires) ? $this->expires : 0,\n\t\t\t'last_updated' => filemtime($this->file->getFilenameOnFilestore()),\n\t\t\t'disposition' => $this->disposition == self::DISPOSITION_INLINE ? 'i' : 'a',\n\t\t\t'path' => $relative_path,\n\t\t);\n\n\n\t\tif ($this->use_cookie) {\n\t\t\t$data['cookie'] = _elgg_services()->session->getId();\n\t\t\tif (empty($data['cookie'])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$data['use_cookie'] = 1;\n\t\t} else {\n\t\t\t$data['use_cookie'] = 0;\n\t\t}\n\n\t\tksort($data);\n\t\t$mac = elgg_build_hmac($data)->getToken();\n\n\t\treturn elgg_normalize_url(\"mod/proxy/e{$data['expires']}/l{$data['last_updated']}/d{$data['disposition']}/c{$data['use_cookie']}/$mac/$relative_path\");\n\t}", "function grab_file_content($rawurl, $response = false) {\r\n\r\n\t$url = htmlspecialchars($rawurl, ENT_QUOTES | ENT_HTML5, 'UTF-8', false);\r\n\r\n if(filter_var($url, FILTER_VALIDATE_URL)) {\r\n $file_headers = @get_headers($url);\r\n if(!$file_headers || $file_headers[0] === 'HTTP/1.1 404 Not Found') { return $response; }\r\n }\r\n\r\n\tif(is_callable('curl_init')) {\r\n\t\t$ch = curl_init();\r\n\t\tcurl_setopt($ch, CURLOPT_HEADER, 0);\r\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\r\n\t\tcurl_setopt($ch, CURLOPT_URL, $url);\r\n\t\t$response = curl_exec($ch);\r\n\t\tcurl_close($ch);\r\n\t} \r\n\r\n\tif(empty($response) || !is_callable('curl_init')) {\r\n\t\t$opts = array('http'=>array('header' => 'Connection: close'));\r\n\t\t$context = stream_context_create($opts);\r\n\t\t$headers = get_headers($url);\r\n\t\t$httprequest = substr($headers[0], 9, 3);\r\n\t\tif($httprequest == '200') {\r\n\t\t\t$response = @file_get_contents($url, false, $context);\r\n\t\t}\r\n\t}\r\n\treturn $response;\r\n}", "function remote_file_exists( $url ) {\n $ch = curl_init( $url );\n curl_setopt( $ch, CURLOPT_NOBODY, true );\n curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );\n\n if ( is_localhost() ) {\n curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );\n curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );\n }\n\n curl_exec( $ch );\n $http_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE );\n curl_close( $ch );\n\n if ( $http_code == 200 ) {\n return true;\n }\n return false;\n}", "public static function fixFileUrl($url)\n {\n static $protocol = null;\n if ($protocol === null) {\n $request = Yii::$app->getRequest();\n if ($request instanceof \\yii\\web\\Request) {\n $protocol = $request->getIsSecureConnection() ? 'https' : 'http';\n } else {\n $protocol = 'http';\n }\n }\n\n if (is_string($url) && !strncmp($url, '//', 2)) {\n $url = \"$protocol:$url\";\n }\n return $url;\n }", "function checkRemoteFile($url)\n{\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n // don't download content\n curl_setopt($ch, CURLOPT_NOBODY, 1);\n curl_setopt($ch, CURLOPT_FAILONERROR, 1);\n curl_setopt($ch, CURLOPT_HEADER, 1);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n $result = curl_exec($ch);\n if ($result !== FALSE)\n {\n return true;\n }\n else\n {\n return false;\n }\n}", "function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 10)\r\n{\r\n\tglobal $_CLASS;\r\n\r\n\tif ($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout))\r\n\t{\r\n\t\t@fputs($fsock, \"GET $directory/$filename HTTP/1.1\\r\\n\");\r\n\t\t@fputs($fsock, \"HOST: $host\\r\\n\");\r\n\t\t@fputs($fsock, \"Connection: close\\r\\n\\r\\n\");\r\n\t\r\n\t\t$file_info = '';\r\n\t\t$get_info = false;\r\n\r\n\t\twhile (!@feof($fsock))\r\n\t\t{\r\n\t\t\tif ($get_info)\r\n\t\t\t{\r\n\t\t\t\t$file_info .= @fread($fsock, 1024);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$line = @fgets($fsock, 1024);\r\n\t\t\t\tif ($line == \"\\r\\n\")\r\n\t\t\t\t{\r\n\t\t\t\t\t$get_info = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if (strpos($line, '404 Not Found') !== false)\r\n\t\t\t\t{\r\n\t\t\t\t\t$errstr = $_CLASS['core_user']->lang['FILE_NOT_FOUND'] . ': ' . $filename;\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t@fclose($fsock);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif ($errstr)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$errstr = 'fsock disabled';\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn $file_info;\r\n}", "function get_url_contents($sFile)\n{\n $rCh = curl_init();\n curl_setopt($rCh, CURLOPT_URL, $sFile);\n curl_setopt($rCh, CURLOPT_HEADER, 0);\n curl_setopt($rCh, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($rCh, CURLOPT_FOLLOWLOCATION, 1);\n $mResult = curl_exec($rCh);\n curl_close($rCh);\n unset($rCh);\n\n return $mResult;\n}", "public function testRemoteFile()\n {\n $url = 'https://www.google.com/';\n $crawler = new Crawler($url, 1);\n $crawler->traverse();\n $links = $crawler->getLinks();\n $this->assertEquals(get_class($crawler->getScrapClient()), \\Goutte\\Client::class);\n\n $this->assertEquals($links['https://www.google.com/']['status_code'], 200, $url.' shall be 200 ok');\n $this->assertGreaterThan(3, count($links));\n }", "protected function getUrlForFilename($remoteFile)\n {\n return sprintf(\n 'http://%s:%d%s',\n $this->host,\n $this->port,\n (substr($remoteFile, 0, 1) != '/' ? '/' . $remoteFile : $remoteFile)\n );\n }", "function get_file_content($url, $verbose=false) {\n\tglobal $AUTH_SELF_USERNAME, $AUTH_SELF_PASSWD;\n\n\tif (!$url) {\n\t\treturn null;\n\t} else {\n\t\ttry {\n\t\t\t//Split URL into 2 parts\n\t\t\t\t$get = array();\n\t\t\tif (preg_match(\"/(.*)?(.*)/\",$url,$match))\n\t\t\t{\n\t\t\t\t$url=$match[1];\n\t\t\t\t$get_str=$match[2];\n\t\t\t\tif ($get_str) $get = array($get_str);\n\t\t\t}\n\t\t\t\n\t\t\treturn parametrizable_curl($url);\n\t\t} catch (Exception $e) {\n\t\t\tinform_bad_external_web($e);\n\t\t}\n\t}\n}", "function download_remote_file( $url, $folder, $file ) {\n if ( ! is_dir( $folder ) ) {\n mkdir( $folder, 0755, true );\n }\n\n $fp = fopen( $file, 'wb' );\n\n $ch = curl_init( $url );\n curl_setopt( $ch, CURLOPT_FILE, $fp );\n curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );\n curl_setopt( $ch, CURLOPT_HEADER, 0 );\n\n if ( is_localhost() ) {\n curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );\n curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );\n }\n\n curl_exec( $ch );\n curl_close( $ch );\n\n fflush( $fp );\n fclose( $fp );\n}", "function flo_get_url($url) {\n if (preg_match('~^https?\\:\\/\\/~si', $url)) {\n return $url;\n } else {\n return 'http://' . $url;\n }\n}", "public function getFileUrl ($path);", "private function get_url($url_suffix = '/account', $require_extension = true)\n {\n $url_list = array();\n $url_list[] = $this->sharedshelf_url.$url_suffix;\n\n $ch = curl_init();\n if (false === $ch) {\n curl_close($ch);\n throw new Exception(\"Bad request url in get_url: $url\", 1);\n }\n\n for ($redirects = 0; $this->follow_redirects($ch, $url_list); ++$redirects);\n $url = end($url_list);\n\n curl_close($ch);\n\n if ($require_extension) {\n $extension = pathinfo($url, PATHINFO_EXTENSION);\n if (empty($extension)) {\n throw new Exception(\"Missing required extension: $url\", 1);\n }\n }\n\n return $url;\n }", "public function getPrivateDownloadUrl($path, $protocol = null)\n {\n $url = $this->getDownloadUrl($path, $protocol);\n\n $location = $this->getAuth()->privateDownloadUrl($url);\n // todo: if file not exists.\n return $location;\n }", "function actionGetLocalFileByUrl() {\n\t\t$url = $this->request->url;\n\t\tif (!$url) {\n\t\t\tthrow new \\Exception('Need full url', 400);\n\t\t}\n\n\t\t$parts = parse_url($url);\n\n\t\tif (empty($parts['path'])) {\n\t\t\tthrow new \\Exception('Empty url', 400);\n\t\t}\n\n\t\t$found = false;\n\t\t$path = '';\n\t\t$root = '';\n\n\t\t$key = 0;\n\n\t\tforeach ($this->config->sources as $key => $source) {\n\t\t\tif ($this->request->source && $this->request->source !== 'default' && $key !== $this->request->source && $this->request->path !== './') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$base = parse_url($source->baseurl);\n\n\t\t\t$path = preg_replace('#^(/)?' . $base['path'] . '#', '', $parts['path']);\n\n\n\t\t\t$root = $source->getPath();\n\n\t\t\tif (file_exists($root . $path) && is_file($root . $path) && $this->isGoodFile($root . $path, $source)) {\n\t\t\t\t$found = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!$found) {\n\t\t\tthrow new \\Exception('File does not exist or is above the root of the connector', 424);\n\t\t}\n\n\t\treturn [\n\t\t\t'path' => str_replace($root, '', dirname($root . $path) . DIRECTORY_SEPARATOR),\n\t\t\t'name' => basename($path),\n\t\t\t'source' => $key\n\t\t];\n\t}", "function fileGetContentsCurl($url)\n{\n $ch = curl_init();\n\n curl_setopt($ch, CURLOPT_AUTOREFERER, true);\n curl_setopt($ch, CURLOPT_HEADER, 0);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n\n $data = curl_exec($ch);\n curl_close($ch);\n\n return $data;\n}", "abstract public function getURL();", "function fetch_remote_file ($url) {\n\t$fp = @fopen($url, 'r');\n\t\n\tif ( ! $fp ) {\n\t\treturn array(0, \"Unable to open remote file: $url\");\n\t}\n\t\n\twhile ( ! feof($fp) ) {\n\t\t$data .= fread( $fp, 1024 );\n\t}\n\tfclose($fp);\n\t\n\treturn array(1, $data);\n}", "function isFileRemote($url) {\n $context = stream_context_create(array('http' =>array('method'=>'HEAD')));\n $fd = @fopen($url, 'rb', false, $context);\n if ($fd!==false) {\n fclose($fd);\n $this->addLog( 'FILE_REMOTE_EXIST', $url );\n return true;\n }\n $this->addLog( 'FILE_REMOTE_NOT_EXIST', $url );\n return false;\n }", "function path2url($file_path) \n {\n $file_path=str_replace('\\\\','/',$file_path);\n $file_path=str_replace(' ', '%20',$file_path);\n $file_path=str_replace($_SERVER['DOCUMENT_ROOT'],'',$file_path);\n $file_path='http://'.$_SERVER['HTTP_HOST'].'/'.$file_path;\n return $file_path;\n // return $Protocol.$_SERVER['HTTP_HOST'].str_replace($_SERVER['DOCUMENT_ROOT'], '', realpath($file));\n }", "public function verifyUrlExists()\r\n {\r\n $result = false;\r\n $this->url = filter_var($this->url, FILTER_VALIDATE_URL);\r\n\r\n /* Open curl connection */\r\n $handle = curl_init($this->url);\r\n\r\n /* Set curl parameter */\r\n curl_setopt_array($handle, array(\r\n CURLOPT_FOLLOWLOCATION => TRUE, // we need the last redirected url\r\n CURLOPT_NOBODY => TRUE, // we don't need body\r\n CURLOPT_HEADER => FALSE, // we don't need headers\r\n CURLOPT_RETURNTRANSFER => FALSE, // we don't need return transfer\r\n CURLOPT_SSL_VERIFYHOST => FALSE, // we don't need verify host\r\n CURLOPT_SSL_VERIFYPEER => FALSE // we don't need verify peer\r\n ));\r\n\r\n /* Get the HTML or whatever is linked in $this->url. */\r\n $response = curl_exec($handle);\r\n\r\n $httpCode = curl_getinfo($handle, CURLINFO_EFFECTIVE_URL); // Try to get the last url\r\n $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); // Get http status from last url\r\n\r\n /* Check for 200 (file is found). */\r\n if ($httpCode == 200) {\r\n $result = true;\r\n }\r\n\r\n return $result;\r\n\r\n /* Close curl connection */\r\n curl_close($handle);\r\n }", "public function getFileRemote($filename)\n {\n $cache_dir = '../../Private/Cache/';\n\n $pathdir = $cache_dir . $this->url_data;\n\n // when not exist path, creati path to source\n if ($this->createPath($pathdir)) {\n $pathfile = $pathdir . $filename;\n\n if (!is_readable($this->url_data . $filename)) {\n $this->url = 'http://' . $this->url_data . $filename;\n if( !$this->isFileRemote( $this->url ) )\n {\n return false;\n }\n\n $filedata = file_get_contents($this->url);\n if( empty($filedata) )\n {\n $this->addLog( 'FILE_DATA_IS_EMPTY', $this->url );\n return false;\n }\n// $cache_dir_real = realpath($cache_dir);\n file_put_contents( $pathfile , $filedata);\n }\n\n // Everything for owner, read and execute for others\n $this->chmodTree($pathfile);\n\n $return = Spyc::YAMLLoad($pathfile);\n return $return;\n }\n return false;\n }", "function PLG_getFilename($url)\n{\n //split the url by /\n $parts=explode(\"/\",$url);\n //get the file name in the url\n $fileName=$parts[count($parts)-1];\n return($fileName);\n}", "static function getRemoteUrlContent($url, $username = null, $password = null) {\r\n if (function_exists('curl_init')) {\r\n $ch = curl_init();\r\n if (!is_null($username) && !is_null($password))\r\n curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Basic ' . base64_encode(\"$username:$password\")));\r\n curl_setopt($ch, CURLOPT_URL, $url);\r\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);\r\n curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);\r\n curl_setopt($ch, CURLOPT_HEADER, false);\r\n $html = curl_exec($ch);\r\n curl_close($ch);\r\n if (strlen($html)) {\r\n return $html;\r\n }\r\n }\r\n\r\n if (ini_get('allow_url_fopen') == true) {\r\n if (!is_null($username) && !is_null($password))\r\n $url = str_replace(\"://\", \"://$username:$password@\", $url);\r\n $html = file_get_contents($url);\r\n if (strlen($html)) {\r\n return $html;\r\n }\r\n }\r\n\r\n // cannot open url, either install curl-php or set allow_url_fopen = true in php.ini\r\n return false;\r\n }", "function um_secure_media_uri( $url ) {\r\n\r\n\tif (is_ssl()) {\r\n\t\t$url = str_replace( 'http:', 'https:', $url );\r\n\t}\r\n\r\n\treturn $url;\r\n}", "public function getDownloadUrl() : string\n {\n // Get the URL and run a replacement with the auth values\n return static::replace($this->auth, $this->config['url']);\n }", "public function getUrl(\n $category,\n $fileName\n ) {\n // if it is not exist\n $runtime = $this->getRuntimeFolder();\n\n $url = 'http';\n if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) {\n $url .= 's';\n }\n $url .= '://';\n if ($_SERVER['SERVER_PORT'] != '80') {\n $url .= $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'];\n } else {\n $url .= $_SERVER['SERVER_NAME'];\n }\n\n return $url\n .str_replace(SITE_ROOT_DIR, '', $runtime).'/'\n .$category.'/'\n .$fileName;\n }" ]
[ "0.6100237", "0.58170795", "0.57800287", "0.5659304", "0.56431854", "0.5642082", "0.55701095", "0.55387527", "0.5495551", "0.54954726", "0.5478573", "0.5378698", "0.5378175", "0.53665197", "0.53560674", "0.5353757", "0.53479546", "0.53316057", "0.5324185", "0.53228563", "0.53221774", "0.5312201", "0.5306022", "0.5297126", "0.52926546", "0.5286538", "0.52377456", "0.523481", "0.5231164", "0.5195841" ]
0.6980853
0
Prepare & return response from sending a client request
protected function _sendClientRequest() { $client = $this->_getInstanceOfClient(); $request = $client->get($this->getFilenameUrlWithProtocol()); return $request->send(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function getResponse();", "public function replyResponse();", "public function outgoingResponse();", "private function createResponse(){\n $request = $this->serviceContainer['request'];\n $rawResponse = $this->serviceContainer['databasehelper']->getResponse($request->requestMethod, $request->requestBody,$request->requestParam);\n\n $this->response = $this->serviceContainer['response']->getResponse($rawResponse, $this->serviceContainer['request']->requestMethod);\n\n }", "protected function performRequest()\n {\n\t\t$this->getRublon()->log(__METHOD__);\n\n\t\tif (empty($this->rawPostBody) AND !empty($this->params)) {\n\t\t\t$this->rawPostBody = json_encode($this->params);\n\t\t}\n\t\t$response = $this->request($this->url, $this->rawPostBody);\n\n\t\t$this->rawResponse = implode('', $response);\n\n\t\t$this->getRublon()->log($this->rawResponse);\n\n\t\t$this->rawResponseHeader = trim(array_shift($response));\n\t\t$this->rawResponseBody = trim(array_shift($response));\n\n\t\t$header = explode(\"\\n\", $this->rawResponseHeader);\n\t\t$this->responseHTTPStatus = array_shift($header);\n\t\tpreg_match('/^HTTP\\/((\\d)|(\\d\\.\\d))\\s(\\d+)/', $this->responseHTTPStatus, $match);\n\t\tif (isset($match[4])) {\n\t\t\t$this->responseHTTPStatusCode = $match[4];\n\t\t}\n\n\t\t// When preg_match pattern didn't match anything somehow\n\t\tif (empty($this->responseHTTPStatusCode)) {\n if (function_exists('http_response_code')) {\n $http_response_code = http_response_code();\n if (!empty($http_response_code)) {\n $this->responseHTTPStatusCode = http_response_code();\n }\n }\n }\n\n\t\tforeach ($header as $headerLine) {\n\t\t\tif (strpos($headerLine, ':') !== false) {\n\t\t\t\tlist($name, $value) = explode(':', $headerLine, 2);\n\t\t\t\t$this->responseHeaders[trim($name)] = trim($value);\n\t\t\t}\n\t\t}\n\n\t\treturn $this;\n\t}", "public function prepareResponse(): void\n {\n // change default HTTP status code\n $this->response->setStatusCode(200);\n\n // clear default response headers\n $this->response->resetHeaders();\n\n // add your response headers\n $this->response->setCharset('UTF-8');\n $this->response->setContentType('text/html');\n $this->response->addHeader(\n 'X-Some-Header-Example-Name: headerValueExample'\n ); // add some other headers by this example\n\n // call here your controller to get real response body\n $body = 'This is an example generated in Route <i>' . get_class($this) . '</i> with a fictive Controller.';\n\n // set body to response as response body\n $this->response->setBody($body);\n }", "public function getResponse () {}", "protected function respond()\n {\n $statusCode = $this->response->getStatusCode();\n\n //Don't resend headers if they've already been sent\n if (!headers_sent()) {\n header(sprintf(\n 'HTTP/%s %s %s',\n $this->response\n ->getProtocolVersion(),\n $statusCode,\n $this->response\n ->getReasonPhrase()\n ), true, $statusCode);\n\n $headers = $this->response\n ->getHeaders();\n\n //Set each individual header of the response if any exists.\n if (!empty($headers)) {\n foreach ($this->response->getHeaders() as $key => $values) {\n foreach ($values as $value) {\n header(sprintf(\n '%s: %s',\n $key,\n $value\n ), false);\n }\n }\n }\n }\n\n $responseSize = $this->response\n ->getBody()\n ->getSize();\n\n if ($responseSize !== null) {\n $response = $this->response\n ->withHeader('Content-Length', $responseSize.'');\n\n $body = $this->response\n ->getBody();\n\n if ($body->isSeekable()) {\n $body->rewind();\n }\n\n /*\n Notice that print and echo writes to the output stream and so there's no \n point in opening the stream to write the contents myself.\n */\n while (!$body->eof()) {\n echo $body->read(Stream::CHUNK_SIZE);\n\n /*\n If the connection status to the client is anythin but normal then stop \n writing data to the output stream\n */\n if (connection_status() != CONNECTION_NORMAL) {\n break;\n }\n }\n }\n }", "public function getResponse() {}", "protected function send()\n {\n // Zend\\Http\\Client uses http_build_query(), that depends on arg_separator.output\n $separator = ini_get('arg_separator.output');\n $scoped = new scoped(function () use ($separator)\n {\n ini_set('arg_separator.output', $separator);\n });\n ini_set('arg_separator.output', '&');\n\n return $this->client->send();\n }", "public function sendRequest()\n {\n $this->rawResponse = $this->curl->exec();\n }", "public function get_response();", "protected function send_response() {\n $this->prepare_response();\n $this->send_headers();\n echo $this->response;\n }", "public function send()\n {\n $response = Response::getInstance();\n\n // Set the header\n $response->header()->httpResponseCode($this->statusCode);\n $response->header()->clear();\n $response->header()->contentType('application/json', config_get('main.charset', 'UTF-8'), true);\n $response->header()->expires('0');\n $response->header()->lastModified(gmdate(DATE_RFC822));\n $response->header()->cacheControl('no-store, no-cache, must-revalidate');\n $response->header()->cacheControl('post-check=0, pre-check=0', false);\n $response->header()->pragma('no-cache');\n\n $response->body($this->fetch());\n }", "public function getResponse()\n {\n $ch = curl_init();\n if ($this->httpMethod != HttpMethod::GET) {\n curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpMethod);\n if (is_array($this->body) || $this->body instanceof Traversable) {\n HttpRequest::http_build_query_for_curl($this->body, $postBody);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $postBody);\n } else {\n curl_setopt($ch, CURLOPT_POSTFIELDS, $this->body);\n }\n } else if (is_array($this->body)) {\n if (strpos($this->url, '?') !== false) {\n $this->url .= \"&\";\n } else {\n $this->url .= \"?\";\n }\n HttpRequest::http_build_query_for_curl($this->body, $postBody);\n $url .= urldecode(http_build_query($postBody));\n }\n\n curl_setopt($ch, CURLOPT_URL, HttpRequest::encodeUrl($this->url));\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n curl_setopt($ch, CURLOPT_MAXREDIRS, 10);\n curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);\n curl_setopt($ch, CURLOPT_HEADER, true);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, HttpRequest::$verifyPeer);\n curl_setopt($ch, CURLOPT_ENCODING, \"\"); // If an empty string, \"\", is set, a header containing all supported encoding types is sent.\n if (HttpRequest::$socketTimeout != null) {\n curl_setopt($ch, CURLOPT_TIMEOUT, HttpRequest::$socketTimeout);\n }\n if (!empty($this->username)) {\n curl_setopt($ch, CURLOPT_USERPWD, $this->username . \":\" . ((empty($this->password)) ? \"\" : $this->password));\n }\n\n $response = curl_exec($ch);\n $error = curl_error($ch);\n if ($error) {\n throw new Exception($error);\n }\n\n // Split the full response in its headers and body\n $curl_info = curl_getinfo($ch);\n $header_size = $curl_info[\"header_size\"];\n $header = substr($response, 0, $header_size);\n $body = substr($response, $header_size);\n $httpCode = $curl_info[\"http_code\"];\n\n return new HttpResponse($httpCode, $body, $header);\n }", "abstract protected function getResponseData();", "private function performRequest()\n {\n // Set up a default response in case of a failed communication with the Outpost.\n $response = $this->getDefaultResponse();\n\n try {\n $client = new Client;\n $response = $client->request('POST', self::ENDPOINT, ['json' => $this->getPayload(), 'timeout' => 5]);\n $response = json_decode($response->getBody()->getContents(), true);\n } catch (RequestException $e) {\n Log::notice(\"Couldn't reach the Statamic Outpost.\");\n } catch (Exception $e) {\n Log::error(\"Ran into an issue when contacting the Statamic Outpost.\");\n }\n\n $this->response = $response;\n }", "public function requestResponse ()\n {\n // include database and instantiate database obj\n include_once './config/database.php';\n $database = new Database();\n $db = $database->getConnection();\n\n /*\n * decides which file to include depending on \n * $this->object then will choose object's function \n * depending on $this->method\n */\n switch ($this->object)\n {\n case 'proposal-votes':\n return $this->proposalVotesResponse($db);\n break;\n case 'sabats':\n return $this->sabatsResponse($db);\n break;\n case 'login':\n return $this->loginResponse($db);\n break;\n case 'sabat-results':\n return $this->sabatResultsResponse($db);\n break;\n }\n }", "protected function send_response() {\n $newarray = self::correct_result($this->returns);\n $this->send_headers();\n echo json_encode($newarray);\n }", "private function _request()\n {\n $ch = curl_init();\n \n $url = self::END_POINT;\n $url .= http_build_query($this->option);\n \n if (strtoupper($this->method) == 'POST') {\n $url = self::END_POINT;\n curl_setopt($ch, CURLOPT_POST, 1);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $this->option); \n }\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_USERAGENT, $this->_agent); \n $out = curl_exec($ch);\n curl_close($ch);\n \n return $out;\n }", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();" ]
[ "0.6183785", "0.6139474", "0.60597795", "0.60430855", "0.602967", "0.5965463", "0.59381753", "0.5926617", "0.59202904", "0.5901738", "0.58960766", "0.5890716", "0.5868642", "0.5861041", "0.5852728", "0.5826818", "0.58232546", "0.5821136", "0.58176994", "0.57936746", "0.5791127", "0.5791127", "0.5791127", "0.5791127", "0.5791127", "0.5791127", "0.5791127", "0.5791127", "0.5791127", "0.5791127" ]
0.6166241
1
Allowed text selectors getter.
public static function get_allowed_text_selectors() { return array_merge( behat_partial_named_selector::get_allowed_text_selectors(), behat_exact_named_selector::get_allowed_text_selectors() ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function textless() {\r\n return $this->parse_list('textless');\r\n }", "abstract public function selector();", "public function getSelectors()\n {\n return $this->selectors;\n }", "public function selectByVisibleText($text);", "public function selector()\n {\n return $this->selector;\n }", "public function getSelector() {\n return $this->_selector;\n }", "public function getText();", "public function getText();", "public function getText();", "public function getText();", "public function selectorVariantProvider()\n {\n return [\n 'Simple tag name' => ['a'],\n 'Class name' => ['.link'],\n 'Multiple class names' => ['.link.another-class'],\n 'Element ID' => ['#my-link'],\n 'Tag name with class' => ['a.link'],\n 'Tag name with ID' => ['a#my-link'],\n 'Tag with href attribute' => ['a[href=\"https://example.com\"]'],\n ];\n }", "function obtSelector () {\n\n return $this->selector;\n\n }", "public function get_textinputs ()\n\t{\n\t\treturn $this->_text_inputs;\n\t}", "public function selector(): string\n {\n return '';\n }", "public function getSelector(): string\n {\n return $this->selector;\n }", "public function getSelector()\n {\n return $this->selector;\n }", "public function get_selector() {\n\t\treturn $this->selector;\n\t}", "public function getHighlightHighlightMultiTerm() {}", "public function selectByVisiblePartialText($text);", "public function getTextDecoration () {}", "public function selector()\n {\n return $this->menu->selector;\n }", "public function getSelector(): ?string {\n return $this->get('selector');\n }", "public function get_text()\n{\n return $this->text;\n}", "public function withDocumentsText(): static\n {\n return $this->addExtensionsFromPresets(static::PRESET_DOCUMENTS_TEXT);\n }", "public function get_unselectable_words($questiontext) {\n $questiontext = $this->get_questiontext_exploded($questiontext);\n $allwords = preg_split('/[\\s\\n]/', $questiontext);\n $unselectable = array();\n $started = false;\n foreach ($allwords as $key => $word) {\n $start = substr($word, 0, 1);\n $len = strlen($word);\n $end = substr($word, $len - 1, $len);\n if ($start == \"*\") {\n $started = true;\n }\n if ($end == \"*\") {\n $started = false;\n $unselectable[$key] = $word;\n }\n if ($started == true) {\n $unselectable[$key] = $word;\n }\n }\n return $unselectable;\n }", "public function getText() : string;", "protected function parse_selector($string){\n\t\tif (substr($string, 0, 13) == ':input[name=\"'){\n\t\t\t$select = substr($string, 13, -2);\n\t\t\t$bracket = strpos($select, '[');\n\t\t\t$field_name = substr($select, 0, $bracket);\n\t\t\t$lang = substr($select, $bracket+1, -1);\n\t\t\treturn array($field_name, $lang);\n\t\t}else{\n\t\t\tthrow new Exception('Unable to parse selector');\n\t\t}\n\t}", "public function getText( ) { \n return $this->text;\n }", "public function get_text ()\n {\n return $this->text;\n }", "private function getText ()\n {\n\n return $this->text;\n }" ]
[ "0.60603774", "0.59750205", "0.5955059", "0.5831904", "0.568271", "0.56623966", "0.56404144", "0.56404144", "0.56404144", "0.56404144", "0.56348866", "0.5571043", "0.55461", "0.5531423", "0.5503779", "0.5458711", "0.539568", "0.5382709", "0.5378187", "0.5332247", "0.5303505", "0.5268032", "0.52225494", "0.5176542", "0.51651126", "0.5155302", "0.51446956", "0.5143487", "0.5143193", "0.514072" ]
0.7954564
0
Sync removed, difference and new attributes values with "attribute" property.
private function syncAttributes() { foreach ($this->removedAttributes as $key => $removedAttribute) { unset($this->attributes[$removedAttribute]); } $this->removedAttributes = []; foreach ($this->newAttributes as $newAttribute => $value) { $this->attributes[$newAttribute] = $value; } $this->newAttributes = []; foreach ($this->diffAttributes as $diffAttribute => $value) { $this->attributes[$diffAttribute] = $value; } $this->diffAttributes = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function syncOriginalAttribute($attribute)\n {\n $this->original[$attribute] = $this->attributes[$attribute];\n\n return $this;\n }", "public function setRawAttributes(array $attributes, $sync=false);", "public function mutateAttribute()\n {\n $element = $this->getObject();\n\n $attributes = $element->getAttributes();\n\n $random_attribute = array_rand($attributes);\n $letters = range('a', 'z');\n $letter = $letters[array_rand($letters)];\n\n $attribute_value = $attributes[$random_attribute] . $letter;\n\n if (strlen($attribute_value) > 10) {\n // Don't let the attribute get longer than 10 characters.\n $attribute_value = substr($attribute_value, -8);\n }\n\n $attributes[$random_attribute] = $attribute_value;\n\n $element->setAttributes($attributes);\n }", "protected function resetAttribute($attribute) {\n $this->owner->$attribute = $this->owner->oldAttributes[$attribute];\n }", "public function __set($attribute, $value) {}", "public function setSyncAttributes(array $attributes): static\n {\n $this->syncAttributes = $attributes;\n\n return $this;\n }", "abstract protected function __setAttribute( $strAttribute, $mixValue );", "public function setRawAttributes(array $attributes, $sync = false)\n {\n $this->attributes = $attributes;\n if ($sync) {\n $this->syncOriginal();\n }\n }", "public function attributesToArray()\n {\n $attributes = $this->getArrayableAttributes();\n\n // If an attribute is a date, we will cast it to a string after converting it\n // to a DateTime / Carbon instance. This is so we will get some consistent\n // formatting while accessing attributes vs. arraying / JSONing a model.\n foreach ($this->getDates() as $key) {\n if (! isset($attributes[$key])) {\n continue;\n }\n\n $attributes[$key] = $this->serializeDate(\n $this->asDateTime($attributes[$key])\n );\n }\n\n $mutatedAttributes = $this->getMutatedAttributes();\n\n // We want to spin through all the mutated attributes for this model and call\n // the mutator for the attribute. We cache off every mutated attributes so\n // we don't have to constantly check on attributes that actually change.\n foreach ($mutatedAttributes as $key) {\n if (! array_key_exists($key, $attributes)) {\n continue;\n }\n\n $attributes[$key] = $this->mutateAttributeForArray(\n $key, $attributes[$key]\n );\n }\n\n // Next we will handle any casts that have been setup for this model and cast\n // the values to their appropriate type. If the attribute has a mutator we\n // will not perform the cast on those attributes to avoid any confusion.\n foreach ($this->getCasts() as $key => $value) {\n if (! array_key_exists($key, $attributes) ||\n in_array($key, $mutatedAttributes)) {\n continue;\n }\n\n $attributes[$key] = $this->castAttribute(\n $key, $attributes[$key]\n );\n\n if ($attributes[$key] && ($value === 'date' || $value === 'datetime')) {\n $attributes[$key] = $this->serializeDate($attributes[$key]);\n }\n }\n\n foreach ($attributes as $key => $value) {\n if ($this->isCassandraObject($value)) {\n $attributes[$key] = $this->valueFromCassandraObject($value);\n }\n }\n\n // Here we will grab all of the appended, calculated attributes to this model\n // as these attributes are not really in the attributes array, but are run\n // when we need to array or JSON the model for convenience to the coder.\n foreach ($this->getArrayableAppends() as $key) {\n $attributes[$key] = $this->mutateAttributeForArray($key, null);\n }\n\n return $attributes;\n }", "public function syncOriginal()\n {\n $this->original = $this->attributes;\n return $this;\n }", "private function _setAttributes()\n {\n if (!$this->autoColumns)\n return;\n $this->autoColumns = false;\n $this->createAttribute = $this->_getAttribute($this->createAttributes);\n $this->updateAttribute = $this->_getAttribute($this->updateAttributes);\n }", "public function setAttribute(&$model, $attribute, $oldValue)\n {\n $modelValue = $model->$attribute;\n if ($modelValue != '') {\n $command = $this->_transformFileValue($modelValue);\n if (! empty($command)) {\n if ($command['action'] === self::ACTION_INSERT) { // insert file\n $this->_setAttributeModeInsert($model, $attribute, $oldValue, $command, $modelValue);\n } elseif ($command['action']=== self::ACTION_DELETE && $oldValue === basename($command['key'])) { // delete file\n $this->_setAttributeModeDelete($model, $attribute, $oldValue, $command, $modelValue);\n }\n } else {\n $model->uploadOperations[$attribute] = array(\n 'action' => '',\n 'postModelAttribute' => $modelValue,\n 'oldValue' => $oldValue\n );\n }\n } else {\n $model->$attribute = '';\n $model->uploadOperations[$attribute] = array(\n 'action' => '',\n 'postModelAttribute' => $modelValue,\n 'oldValue' => $oldValue\n );\n }\n }", "private function diffAttributes(array $attributes)\n {\n $modifies = [];\n\n foreach ($attributes as $attribute => $value) {\n\n if(in_array($attribute, $this->attributes)){\n if(is_array($value)){\n // May be required some conditions for compare\n if(! ($value === $this->attributes[$attribute])){\n\n $modifies[] = [\n \"attrib\" => $attribute,\n \"modtype\" => LDAP_MODIFY_BATCH_REMOVE_ALL\n ];\n\n $modifies[] = [\n \"attrib\" => $attribute,\n \"modtype\" => LDAP_MODIFY_BATCH_ADD,\n \"values\" => [$value]\n ];\n\n $this->diffAttributes[$attribute] = $value;\n }\n }else{\n if($this->attributes[$attribute] != $value) {\n $modifies[] = [\n \"attrib\" => $attribute,\n \"modtype\" => LDAP_MODIFY_BATCH_REPLACE,\n \"values\" => [$value]\n ];\n\n $this->diffAttributes[$attribute] = $value;\n }\n }\n }\n }\n\n return $modifies;\n }", "public function syncAttributes($categories, $attributes, $product)\n {\n foreach($attributes as $key => $value)\n {\n if ($value == 'NULL')\n {\n unset($attributes[$key]);\n }\n }\n // Sync attributes\n $product->attributeValues()->sync($attributes);\n\n // Sync Product to Categorie(s)\n $product->productCategories()->sync($categories);\n }", "public function getOldAttributes();", "public function update(Attribute $attribute)\n {\n $this->validate(request(), [\n 'name' => 'required|max:255|unique:attributes,name,'.$attribute->id,\n ], [\n 'name.required' => 'Tên thuộc tính là bắt buộc',\n 'name.max' => 'Tên thuộc tính ít hơn 255 kí tự',\n 'name.unique' => 'Tên thuộc tính đã tồn tại.',\n ]);\n\n $attribute->forceFill([\n 'name' => trim(request('name')),\n ])->save();\n\n return $attribute;\n }", "public function storeProperties() {\n if (!$this->touched)\n return;\n foreach (xattr_list($this->localPath) as $attribute)\n if (!isset($this->stored_props[rawurldecode($attribute)]))\n xattr_remove($this->localPath, $attribute);\n foreach ($this->stored_props as $name => $value)\n xattr_set($this->localPath, rawurlencode($name), $value);\n $this->touched = false;\n }", "public function getNewAttributes();", "public function syncOriginal()\n {\n $this->original = $this->attributes;\n\n return $this;\n }", "public function syncOriginal()\n {\n $this->original = $this->attributes;\n\n return $this;\n }", "public function syncOriginal()\n {\n $this->original = $this->attributes;\n\n return $this;\n }", "function set($a,$v) { $this->attributes[$a] = $v; }", "public function syncVariationAttributes($business_id)\n {\n $woocommerce = $this->woo_client($business_id);\n $query = VariationTemplate::where('business_id', $business_id);\n\n $attributes = $query->get();\n $data = [];\n $new_attrs = [];\n foreach ($attributes as $attr) {\n if (empty($attr->woocommerce_attr_id)) {\n $data['create'][] = ['name' => $attr->name];\n $new_attrs[] = $attr;\n } else {\n $data['update'][] = [\n 'name' => $attr->name,\n 'id' => $attr->woocommerce_attr_id\n ];\n }\n }\n\n if (!empty($data)) {\n $response = $woocommerce->post('products/attributes/batch', $data);\n\n //update woocommerce_attr_id\n if (!empty($response->create)) {\n foreach ($response->create as $key => $value) {\n $new_attr = $new_attrs[$key];\n if ($value->id != 0) {\n $new_attr->woocommerce_attr_id = $value->id;\n } else {\n $all_attrs = $woocommerce->get('products/attributes');\n foreach ($all_attrs as $attr) {\n if (strtolower($attr->name) == strtolower($new_attr->name)) {\n $new_attr->woocommerce_attr_id = $attr->id;\n }\n }\n }\n $new_attr->save();\n }\n }\n }\n }", "public static function UpdateAttributeSpec($attribute,$id){\n\t\t\t$save =DB::table('attribute_master')->where('id',$id)->update($attribute);\n\t\t\treturn $save;\n\t}", "public function setAttributes($attributes);", "function set_attributes($attrib)\r\n\t{\r\n\t\t$this->attributes = $attrib;\r\n\t}", "public function attributesToArray()\n {\n $attributes = $this->getAccessibleAttributes();\n // We want to spin through all the mutated attribtues for this model and call\n // the mutator for the attribute. We cache off every mutated attributes so\n // we don't have to constantly check on attributes that actually change.\n foreach ($this->getMutatedAttributes() as $key) {\n if (!array_key_exists($key, $attributes)) {\n continue;\n }\n $attributes[$key] = $this->mutateAttribute($key, $attributes[$key]);\n }\n return $attributes;\n }", "private function proceedBranchRelativeAttributes() {\n foreach ($this->attributes as $attributeName => $attribute) {\n switch ($attributeName) {\n case 'email':\n $this->saveBranchRelativeAttribute($this->emails, $this->branch->email);\n break;\n case 'site':\n $this->saveBranchRelativeAttribute($this->sites, $this->branch->site);\n break;\n case 'phone':\n $this->saveBranchRelativeAttribute($this->phones, $this->branch->phone);\n break;\n case 'description_us':\n $this->saveBranchRelativeAttribute($this->descriptions, $this->branch->description);\n break;\n case 'city_id':\n $this->saveBranchRelativeAttribute($this->locations, $this->branch->location);\n break;\n case 'category_id':\n $this->saveBranchRelativeAttribute($this->categories, $this->branch->category);\n break;\n }\n }\n }", "public function getDirtyAttributes();", "protected function _setAttributeModeDelete(&$model, &$attribute, &$oldValue, &$command, &$modelValue)\n {\n $model->$attribute = '';\n $model->uploadOperations[$attribute] = array(\n 'action' => self::ACTION_DELETE,\n 'postModelAttribute' => $modelValue,\n 'oldValue' => $oldValue,\n 'value' => basename($command['key'])\n );\n }" ]
[ "0.6183639", "0.60061973", "0.5857001", "0.5763895", "0.5658413", "0.5634999", "0.5566431", "0.55524164", "0.55516", "0.5451816", "0.54440784", "0.54334146", "0.5408297", "0.53963935", "0.53678596", "0.533582", "0.5320546", "0.53159004", "0.5294908", "0.5294908", "0.5294908", "0.52485234", "0.52246267", "0.52152187", "0.5186177", "0.5175125", "0.51701087", "0.51639205", "0.51614606", "0.51600355" ]
0.79883695
0
Replace tags with their assigned data
public function tagAll() { preg_match_all("#{{([^}]+?)}}#", $this->_html, $tags); if(count($tags[1])) { foreach ($tags[1] as $tag) { if($this->getData($tag)) $this->_html = str_replace('{{' . $tag . '}}', $this->getData($tag), $this->_html); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function convert_tags(){\n $Tag = new Tag();\n $Tag->set_tags($this->tags);\n $this->tags = $Tag->convert_tag();\n }", "private static function replaceTags($tag) {\n\t\t\tif (is_array(self::$variables) && !empty(self::$variables)) {\n\t\t\t\t// variable ids\n\t\t\t\t$ids = array_keys(self::$variables);\n\t\t\t\t// variable values\n\t\t\t\t$vals = array_values(self::$variables);\n\t\t\t\t// replace each variable with its value\n\t\t\t\t$tag = str_ireplace($ids, $vals, $tag);\n\t\t\t}\n\t\t\t// strip remaining variables and return\n\t\t\treturn preg_replace('/{[A-Z0-9]*}/', '', $tag);\n\t\t}", "public function fixTags()\n {\n $tags = $this->fetchTags();\n\n if (count($tags)) {\n $newest = reset($tags);\n } else {\n $newest = '';\n }\n\n $changes = $this->fetchInfoTxtChanges($newest);\n\n foreach ($changes as $version => $sha) {\n if (!isset($tags[$version])) {\n $this->setTag($sha, $version);\n }\n }\n }", "function process_tags()\n {\n }", "function merge_template_data( $template, $data ) {\n\tforeach ( get_merge_tags() as $tag ) {\n\t\t$replacement = ( array_key_exists( $tag, $data ) ) ? $data[ $tag ] : '';\n\t\t$template = preg_replace( \"#\\{$tag\\}#\", $replacement, $template );\n\t}\n\n\treturn $template;\n}", "protected function convertTagsToPlaceholders($text)\n {\n // placeholder to replace them, before converting them to headings.\n $origTags = [];\n $this->replaceTags = [];\n $this->coolTags = [];\n \n preg_match_all(\"/[^&]{1}(#[\\w\\d\\-]+)/\", $text, $matches);\n \n if (isset($matches[1])) {\n foreach ($matches[1] as $i => $tag) {\n if (is_numeric($tag)) continue;\n if (strlen($tag) == 0) continue;\n $origTags[] = $tag;\n $tagLower = strtolower($tag);\n $tagWord = substr($tagLower, 1);\n $this->replaceTags[] = $replace = \"@@TAG@PLACEHOLDER@{$i}@@\";\n $this->coolTags[] = \"<span class=\\\"chip\\\">$tagLower</span>\";\n $text = preg_replace(\"/$tag/\", $replace, $text, 1);\n }\n }\n \n return $text;\n }", "private function _replace_subtag_data($tag_name, $tagdata, $replacement)\n {\n if (is_string($tagdata) && is_string($tag_name) && is_string($replacement))\n {\n // var_dump('by this '.$replacement.' replace'.$tag_name.' on '.$tagdata);\n $pattern = LD.$tag_name.RD ;\n return str_replace($pattern, $replacement, $tagdata);\n }\n return $tagdata;\n }", "function clean_inside_tags($txt,$tags){\n\t\t\t$txt =removeemptytags($txt);\n\t\t\tpreg_match_all(\"/<([^>]+)>/i\",$tags,$allTags,PREG_PATTERN_ORDER);\n\t\t\n\t\t\tforeach ($allTags[1] as $tag){\n\t\t\t\t$txt = preg_replace(\"/<\".$tag.\"[^>]*>/i\",\"<\".$tag.\">\",$txt);\n\t\t\t}\n\t\t\treturn $txt;\n\t\t}", "function replaceCustomTemplateTags($tag, $tagContent) {\n\t\treturn null;\n\t}", "public function replace();", "public function clearTags();", "function PrepareTags() {\n $tags = json_decode(file_get_contents(CONTENT.'tags'), TRUE);\n if (!empty($tags)) {\n $tags = ArrayInvert($tags);\n krsort($tags);\n $tags = ArrayNormalize($tags);\n }\n return $tags;\n}", "private function update_tags($tags) {\n\n\t\t\tforeach ($tags as $id => $key) {\n\n\t\t\t\tin_array($key->term_id, $this->tags) != 1 ? array_push($this->tags, $key->term_id) : '';\n\t\t\t}\n\t\t}", "protected function prepareTagData()\n\t{\n\t\tif (!$this->module->iso_useFieldsForTags) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$data = $this->productData;\n\t\t$tags = [];\n\t\t\n\t\tforeach (deserialize($this->module->iso_tagFields, true) as $tagValueField) {\n//\t\t\tif ($tagValueField == 'type') {\n//\t\t\t\t$data[$tagValueField] = ProductType::findByPk($this->submission->type)->name;\n//\t\t\t}\n\t\t\t\n\t\t\tif ('' == $data[$tagValueField]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\t$tags[] = FormSubmission::prepareSpecialValueForPrint(\n\t\t\t\t$data[$tagValueField],\n\t\t\t\t$GLOBALS['TL_DCA']['tl_iso_product']['fields'][$tagValueField],\n\t\t\t\t'tl_iso_product',\n\t\t\t\t$this->dc\n\t\t\t);\n\t\t}\n\t\t\n\t\t// add tags from form-field\n\t\t$tags = array_merge(deserialize($this->submission->{$this->module->iso_tagField}, true), $tags);\n\t\t\n\t\t// Hook : modify the product data\n\t\tif (isset($GLOBALS['TL_HOOKS']['creatorProduct']['modifyTagData']) && is_array($GLOBALS['TL_HOOKS']['creatorProduct']['modifyTagData'])) {\n\t\t\tforeach ($GLOBALS['TL_HOOKS']['creatorProduct']['modifyTagData'] as $arrCallback) {\n\t\t\t\t$objClass = \\Controller::importStatic($arrCallback[0]);\n\t\t\t\t$tags = $objClass->{$arrCallback[1]}($tags, $this);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// add tag-array to field\n\t\t$this->productData[$this->module->iso_tagField] = serialize($tags);\n\t}", "public function replace_tag($data, $params = '', $tagdata = '')\n\t{\n\t\tif ($tagdata)\n\t\t{\n\t\t\treturn $tagdata;\n\t\t}\n\n\t\treturn $data;\n\t}", "function processTags($object) {\n\t$tagsprefix = 'tags_';\n\t$tags = array();\n\t$l = strlen($tagsprefix);\n\tforeach ($_POST as $key => $value) {\n\t\t$key = postIndexDecode($key);\n\t\tif (substr($key, 0, $l) == $tagsprefix) {\n\t\t\tif ($value) {\n\t\t\t\t$tags[] = substr($key, $l);\n\t\t\t}\n\t\t}\n\t}\n\t$tags = array_unique($tags);\n\t$object->setTags(sanitize($tags, 3));\n}", "private function _replace_pair_subtag_data($tag_name, $tagdata, $replacement)\n {\n $pattern = '#'.LD.$tag_name.RD.'(.*?)'.LD.'/'.$tag_name.RD.'#s';\n if (is_string($tagdata) && is_string($tag_name) && preg_match($pattern, $tagdata, $matches))\n {\n return str_replace($matches[0], $replacement, $tagdata);;\n }\n return '';\n }", "public function set_tags($val) {\n\t\tif (!empty($val)) {\n\t\t\t$tagsArr = \\Base::instance()->split($val);\n\t\t\t$tag_res = new Tag();\n\t\t\t$tags = array();\n\t\t\t// find IDs of known Tags\n\t\t\t$known_tags = $tag_res->find(array('title IN ?', $tagsArr));\n\t\t\tif ($known_tags) {\n\t\t\t\tforeach ($known_tags as $tag)\n\t\t\t\t\t$tags[$tag->_id] = $tag->title;\n\t\t\t\t$newTags = array_diff($tagsArr, array_values($tags));\n\t\t\t} else\n\t\t\t\t$newTags = $tagsArr;\n\t\t\t// create remaining new Tags\n\t\t\tforeach ($newTags as $tag) {\n\t\t\t\t$tag_res->reset();\n\t\t\t\t$tag_res->title = $tag;\n\t\t\t\t$out = $tag_res->save();\n\t\t\t\t$tags[$out->_id] = $out->title;\n\t\t\t}\n\t\t\t// set array of IDs to current Post\n\t\t\t$val = array_keys($tags);\n\t\t}\n\t\treturn $val;\n\t}", "public function setTagElements($data) {\n\t\t$this->_tagElements = $data;\n\t\t$this->tagData = \\CJSON::encode($data);\n\t}", "private function _stripTags() {\n\t\tif (count($this->data[$this->name]) > 0) {\n\t\t\tforeach ($this->data[$this->name] as $field => $value) {\n\t\t\t\tif (isset($this->_schema[$field])) {\n\t\t\t\t\tswitch ($this->_schema[$field]['type']) {\n\t\t\t\t\t\tcase 'string':\n\t\t\t\t\t\t\t$this->data[$this->name][$field] = trim(strip_tags($value));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'text':\n\t\t\t\t\t\t\t//$this->data[$this->name][$field] = trim(strip_tags($value), array('h1','h2','h3','h4','h5','h6','p','em','strong','ul','ol','li','img','a','del'));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function replace_tag($data, $params = array(), $tagdata = FALSE) {\n\t\t// Get the specific value\n\t\t$label = $this->EE->db->select($this->settings['sp_table_select_label'] . ' AS `label`')\n\t\t\t\t\t\t\t ->where($this->settings['sp_table_select_value'], $data)\n\t\t\t\t\t\t\t ->get($this->settings['sp_table_select_table'])\n\t\t\t\t\t\t\t ->row('label');\n\t\t\n\t\t// Return it\n\t\treturn $label;\n\t}", "abstract function replace();", "public function updateTagMetadata()\n {\n $tagArray = $this->getTags(false);\n $tagString = !empty($tagArray) ? implode(\", \", $tagArray) : \"\";\n $this->addMetadata(\"subject\", null, $tagString);\n \n // We need to clear the tag lists of all the parent artworks since they have just changed\n foreach ($this->getParentArtworks() as $artwork)\n {\n reaktorCache::delete(\"artwork_tag_list_\".$artwork->getId());\n }\n }", "abstract protected function preprocessOpenGraphMetaTags($tags);", "function fix_quotes() {\n $sql = SQL::current();\n if (!$tags = $sql->select(\"post_attributes\", array(\"post_id\", \"value\"), array(\"name\" => \"tags\")))\n return;\n\n foreach ($tags->fetchAll() as $attr)\n $sql->replace(\"post_attributes\",\n array(\"post_id\", \"name\"),\n array(\"post_id\" => $attr[\"post_id\"],\n \"name\" => \"tags\",\n \"value\" => YAML::dump(YAML::load($attr[\"value\"]))));\n }", "public function testModifyTag()\n {\n }", "public function updateCTag();", "private function replaceTags(array $tags, $skeleton)\r\n {\r\n foreach ($tags as $tag => $replacement)\r\n {\r\n $skeleton = str_replace($tag, $replacement, $skeleton);\r\n }\r\n\r\n return $skeleton;\r\n }", "private function update_tags($tags)\n\t{\n\t\t$tag_array = explode(',', $tags);\n\t\t$old_tags = $this->generate_tag_list();\n\n\t\tif ($old_tags === $tags)\treturn;\n\n\t\t$old_tags_array = ($old_tags === '') ? array() : explode(',', $old_tags);\n\n\t\tforeach ($old_tags_array as $tag)\n\t\t{\n\t\t\tif ($this->remove_old_tag_from_array($tag, $tag_array))\tcontinue;\n\n\t\t\t// An old tag is removed when the question is edited. So delete the tag from the question.\n\t\t\t$tag_obj = ORM::factory('tag')->get_tag($tag);\n\t\t\t$tag_obj->decrease_post_count();\n\t\t\t\n\t\t\t$this->remove_tag($tag_obj);\n\t\t}\n\t\n\t\t$this->add_tags($this->prepare_new_tags_string($tag_array));\n\t}", "public function replaceTags(array $tags, Taggable $resource)\n {\n $resource->getTags()->clear();\n $this->addTags($tags, $resource);\n }" ]
[ "0.66638803", "0.6458838", "0.6368832", "0.6288441", "0.61416566", "0.6140789", "0.60686845", "0.6047056", "0.6036518", "0.6015723", "0.59161806", "0.5897844", "0.58947986", "0.5851118", "0.5771813", "0.57655317", "0.57631254", "0.5762648", "0.5741781", "0.5735217", "0.5718601", "0.57078445", "0.56931627", "0.56818986", "0.5680065", "0.5668871", "0.56542456", "0.5648572", "0.5625247", "0.5619983" ]
0.7254602
0
line 2184 "smarty_internal_templateparser.php" line 128 "smarty_internal_templateparser.y"
function yy_r6(){ $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function yy_r194(){ $this->_retvalue = new _smarty_code($this, '('.$this->yystack[$this->yyidx + -1]->minor.')'); }", "function yy_r187(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor->to_smarty_php(); }", "function yy_r195(){\n $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + 0]->minor);\n }", "function yy_r192(){if (isset($this->compiler->local_var[\"'\".substr($this->yystack[$this->yyidx + 0]->minor,1).\"'\"])) {\n $this->_retvalue = new _smarty_code($this, '$_smarty_tpl->tpl_vars[\\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\\']->value');\n } else {\n $this->_retvalue = new _smarty_code($this, '$_smarty_tpl->getVariable(\\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\\')->value');\n }\n $this->compiler->tag_nocache = $this->compiler->tag_nocache | $this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor,\"'\"), null, true, false)->nocache;\n }", "function yy_r144(){if ($this->security) {\n $this->compiler->trigger_template_error (self::Err2);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t }\n $this->_retvalue = '->{$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor .')->value'.$this->yystack[$this->yyidx + 0]->minor.'}'; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor,\"'\"), null, true, false)->nocache;\n }", "function yy_r189(){ $this->_retvalue = new _smarty_doublequoted($this, $this->yystack[$this->yyidx + 0]->minor); }", "function yy_r118()\n {\n if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\\'smarty\\'') {\n $smarty_var = $this->compiler->compileTag('private_special_variable', array(), $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);\n $this->_retvalue = $smarty_var;\n } else {\n // used for array reset,next,prev,end,current \n $this->last_variable = $this->yystack[$this->yyidx + 0]->minor['var'];\n $this->last_index = $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + 0]->minor['var']) . $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n }\n }", "function yy_r188()\n {\n $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor->to_smarty_php();\n }", "function yy_r190(){ $this->_retvalue = new _smarty_code($this, $this->yystack[$this->yyidx + -1]->minor); }", "function yy_r119()\n {\n $this->_retvalue = '$_smarty_tpl->tpl_vars[' . $this->yystack[$this->yyidx + - 2]->minor . ']->' . $this->yystack[$this->yyidx + 0]->minor;\n }", "function yy_r128(){ $this->_retvalue = '[$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor.']'; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,\"'\"), null, true, false)->nocache; }", "function yy_r150(){if ($this->security) {\n $this->compiler->trigger_template_error (self::Err2);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t }\n $this->prefix_number++; $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'=$_smarty_tpl->getVariable(\\''. $this->yystack[$this->yyidx + -3]->minor .'\\')->value;?>'; $this->_retvalue = '$_tmp'.$this->prefix_number.'('. implode(',',$this->yystack[$this->yyidx + -1]->minor) .')';\n }", "function yy_r115()\n {\n if ($this->yystack[$this->yyidx + - 2]->minor['var'] == '\\'smarty\\'') {\n $this->_retvalue = $this->compiler->compileTag('private_special_variable', array(), $this->yystack[$this->yyidx + - 2]->minor['smarty_internal_index']) . '::' . $this->yystack[$this->yyidx + 0]->minor;\n } else {\n $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + - 2]->minor['var']) . $this->yystack[$this->yyidx + - 2]->minor['smarty_internal_index'] . '::' . $this->yystack[$this->yyidx + 0]->minor;\n }\n }", "function yy_r98(){ $this->_retvalue = $this->yystack[$this->yyidx + -6]->minor.' ? $_smarty_tpl->getVariable(\\''. $this->yystack[$this->yyidx + -2]->minor .'\\')->value : '.$this->yystack[$this->yyidx + 0]->minor; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable('$this->yystack[$this->yyidx + -2]->minor', null, true, false)->nocache; }", "function yy_r196()\n {\n $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + - 1]->minor);\n }", "function yy_r120(){if (isset($this->compiler->local_var[$this->yystack[$this->yyidx + -2]->minor])) {\n $this->_retvalue = '$_smarty_tpl->tpl_vars['. $this->yystack[$this->yyidx + -2]->minor .']->'.$this->yystack[$this->yyidx + 0]->minor;\n } else {\n $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor;\n }\n $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,\"'\"), null, true, false)->nocache; }", "function yy_r193()\n {\n $this->_retvalue = new _smarty_code($this, '(string)$_smarty_tpl->tpl_vars[\\'' . substr($this->yystack[$this->yyidx + 0]->minor, 1) . '\\']->value');\n }", "function yy_r146(){if ($this->security) {\n $this->compiler->trigger_template_error (self::Err2);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t }\n $this->_retvalue = '->{\\''.$this->yystack[$this->yyidx + -4]->minor.'\\'.'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}';\n }", "function yy_r127(){ $this->_retvalue = '[$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + 0]->minor .')->value]'; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable('$this->yystack[$this->yyidx + 0]->minor', null, true, false)->nocache; }", "function yy_r116(){ if ($this->yystack[$this->yyidx + -2]->minor['var'] == '\\'smarty\\'') { $this->_retvalue = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index']).'::'.$this->yystack[$this->yyidx + 0]->minor;} else {\n $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor['var'] .')->value'.$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index'].'::'.$this->yystack[$this->yyidx + 0]->minor; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor['var'],\"'\"), null, true, false)->nocache;} }", "function yy_r76(){$this->_retvalue = '$_smarty_tpl->getStreamVariable(\\''. $this->yystack[$this->yyidx + -2]->minor .'://'. $this->yystack[$this->yyidx + 0]->minor . '\\')'; }", "function yy_r5(){ $this->_retvalue = new _smarty_tag($this, ''); }", "function yy_r119(){if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\\'smarty\\'') {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$smarty_var = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->_retvalue = $smarty_var;\n } else {\n \t// used for array reset,next,prev,end,current \n \t$this->last_variable = $this->yystack[$this->yyidx + 0]->minor['var'];\n \t$this->last_index = $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n \tif (isset($this->compiler->local_var[$this->yystack[$this->yyidx + 0]->minor['var']])) {\n $this->_retvalue = '$_smarty_tpl->tpl_vars['. $this->yystack[$this->yyidx + 0]->minor['var'] .']->value'.$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n \t} else {\n $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + 0]->minor['var'] .')->value'.$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n \t}\n \t$this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor['var'],\"'\"), null, true, false)->nocache;\n }\n }", "function yy_r13(){if ($this->lex->strip) {\n $this->_retvalue = new _smarty_text($this, preg_replace('![\\t ]*[\\r\\n]+[\\t ]*!', '', $this->yystack[$this->yyidx + 0]->minor));\t\n } else {\n $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor);\t\n }\n }", "function yy_r11(){if ($this->lex->strip) {\n $this->_retvalue = new _smarty_text($this, preg_replace('![\\$this->yystack[$this->yyidx + 0]->minor ]*[\\r\\n]+[\\$this->yystack[$this->yyidx + 0]->minor ]*!', '', self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor)));\t\n } else {\n $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));\t\n }\n }", "function yy_r9(){\n if ($this->php_handling == Smarty::PHP_PASSTHRU) {\n\t\t\t\t\t $this->_retvalue = new _smarty_text($this, '<<?php ?>%');\n } elseif ($this->php_handling == Smarty::PHP_QUOTE) {\n $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));\n }elseif ($this->php_handling == Smarty::PHP_ALLOW) {\n if ($this->asp_tags) {\n $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<%', true));\n } else {\n $this->_retvalue = new _smarty_text($this, '<<?php ?>%');\n }\n }elseif ($this->php_handling == Smarty::PHP_REMOVE) {\n if ($this->asp_tags) {\n $this->_retvalue = new _smarty_text($this, '');\n } else {\n $this->_retvalue = new _smarty_text($this, '<<?php ?>%');\n }\n }\n }", "function yy_r7(){\n if ($this->php_handling == Smarty::PHP_PASSTHRU) {\n\t\t\t\t\t $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));\n } elseif ($this->php_handling == Smarty::PHP_QUOTE) {\n $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));\n }elseif ($this->php_handling == Smarty::PHP_ALLOW) {\n $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<?php', true));\n }elseif ($this->php_handling == Smarty::PHP_REMOVE) {\n $this->_retvalue = new _smarty_text($this, '');\n }\n }", "function yy_r124(){$this->_retvalue = array('var'=>$this->yystack[$this->yyidx + -1]->minor, 'smarty_internal_index'=>$this->yystack[$this->yyidx + 0]->minor); }", "function yy_r12(){ $this->compiler->tag_nocache = true; $this->is_xml = true; $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode(\"<?php echo '<?xml';?>\", $this->compiler, true)); }", "function yy_r140(){ if ($this->yystack[$this->yyidx + -1]->minor['var'] == '\\'smarty\\'') { $this->_retvalue = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index']).$this->yystack[$this->yyidx + 0]->minor;} else {\n $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor['var'] .')->value'.$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index'].$this->yystack[$this->yyidx + 0]->minor; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor['var'],\"'\"), null, true, false)->nocache;} }" ]
[ "0.7437062", "0.7391799", "0.7365035", "0.73175913", "0.73043215", "0.7238411", "0.722547", "0.72214264", "0.7180108", "0.7173159", "0.71592134", "0.7151076", "0.7126525", "0.71135265", "0.7096712", "0.70521533", "0.70411456", "0.7023815", "0.7008282", "0.6998516", "0.69967616", "0.69875383", "0.69630235", "0.69242895", "0.691614", "0.68954605", "0.68608683", "0.6860777", "0.6833623", "0.682804" ]
0.7427444
1
line 2766 "smarty_internal_templateparser.php" line 667 "smarty_internal_templateparser.y"
function yy_r187(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor->to_smarty_php(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function yy_r6(){ $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor); }", "function yy_r194(){ $this->_retvalue = new _smarty_code($this, '('.$this->yystack[$this->yyidx + -1]->minor.')'); }", "function yy_r192(){if (isset($this->compiler->local_var[\"'\".substr($this->yystack[$this->yyidx + 0]->minor,1).\"'\"])) {\n $this->_retvalue = new _smarty_code($this, '$_smarty_tpl->tpl_vars[\\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\\']->value');\n } else {\n $this->_retvalue = new _smarty_code($this, '$_smarty_tpl->getVariable(\\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\\')->value');\n }\n $this->compiler->tag_nocache = $this->compiler->tag_nocache | $this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor,\"'\"), null, true, false)->nocache;\n }", "function yy_r195(){\n $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + 0]->minor);\n }", "function yy_r144(){if ($this->security) {\n $this->compiler->trigger_template_error (self::Err2);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t }\n $this->_retvalue = '->{$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor .')->value'.$this->yystack[$this->yyidx + 0]->minor.'}'; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor,\"'\"), null, true, false)->nocache;\n }", "function yy_r189(){ $this->_retvalue = new _smarty_doublequoted($this, $this->yystack[$this->yyidx + 0]->minor); }", "function yy_r119()\n {\n $this->_retvalue = '$_smarty_tpl->tpl_vars[' . $this->yystack[$this->yyidx + - 2]->minor . ']->' . $this->yystack[$this->yyidx + 0]->minor;\n }", "function yy_r190(){ $this->_retvalue = new _smarty_code($this, $this->yystack[$this->yyidx + -1]->minor); }", "function yy_r98(){ $this->_retvalue = $this->yystack[$this->yyidx + -6]->minor.' ? $_smarty_tpl->getVariable(\\''. $this->yystack[$this->yyidx + -2]->minor .'\\')->value : '.$this->yystack[$this->yyidx + 0]->minor; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable('$this->yystack[$this->yyidx + -2]->minor', null, true, false)->nocache; }", "function yy_r188()\n {\n $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor->to_smarty_php();\n }", "function yy_r128(){ $this->_retvalue = '[$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor.']'; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,\"'\"), null, true, false)->nocache; }", "function yy_r76(){$this->_retvalue = '$_smarty_tpl->getStreamVariable(\\''. $this->yystack[$this->yyidx + -2]->minor .'://'. $this->yystack[$this->yyidx + 0]->minor . '\\')'; }", "function yy_r118()\n {\n if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\\'smarty\\'') {\n $smarty_var = $this->compiler->compileTag('private_special_variable', array(), $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);\n $this->_retvalue = $smarty_var;\n } else {\n // used for array reset,next,prev,end,current \n $this->last_variable = $this->yystack[$this->yyidx + 0]->minor['var'];\n $this->last_index = $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + 0]->minor['var']) . $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n }\n }", "function yy_r127(){ $this->_retvalue = '[$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + 0]->minor .')->value]'; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable('$this->yystack[$this->yyidx + 0]->minor', null, true, false)->nocache; }", "function yy_r150(){if ($this->security) {\n $this->compiler->trigger_template_error (self::Err2);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t }\n $this->prefix_number++; $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'=$_smarty_tpl->getVariable(\\''. $this->yystack[$this->yyidx + -3]->minor .'\\')->value;?>'; $this->_retvalue = '$_tmp'.$this->prefix_number.'('. implode(',',$this->yystack[$this->yyidx + -1]->minor) .')';\n }", "function yy_r7(){\n if ($this->php_handling == Smarty::PHP_PASSTHRU) {\n\t\t\t\t\t $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));\n } elseif ($this->php_handling == Smarty::PHP_QUOTE) {\n $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));\n }elseif ($this->php_handling == Smarty::PHP_ALLOW) {\n $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<?php', true));\n }elseif ($this->php_handling == Smarty::PHP_REMOVE) {\n $this->_retvalue = new _smarty_text($this, '');\n }\n }", "function yy_r120(){if (isset($this->compiler->local_var[$this->yystack[$this->yyidx + -2]->minor])) {\n $this->_retvalue = '$_smarty_tpl->tpl_vars['. $this->yystack[$this->yyidx + -2]->minor .']->'.$this->yystack[$this->yyidx + 0]->minor;\n } else {\n $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor;\n }\n $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,\"'\"), null, true, false)->nocache; }", "function yy_r5(){ $this->_retvalue = new _smarty_tag($this, ''); }", "function yy_r146(){if ($this->security) {\n $this->compiler->trigger_template_error (self::Err2);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t }\n $this->_retvalue = '->{\\''.$this->yystack[$this->yyidx + -4]->minor.'\\'.'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}';\n }", "function yy_r115()\n {\n if ($this->yystack[$this->yyidx + - 2]->minor['var'] == '\\'smarty\\'') {\n $this->_retvalue = $this->compiler->compileTag('private_special_variable', array(), $this->yystack[$this->yyidx + - 2]->minor['smarty_internal_index']) . '::' . $this->yystack[$this->yyidx + 0]->minor;\n } else {\n $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + - 2]->minor['var']) . $this->yystack[$this->yyidx + - 2]->minor['smarty_internal_index'] . '::' . $this->yystack[$this->yyidx + 0]->minor;\n }\n }", "function yy_r119(){if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\\'smarty\\'') {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$smarty_var = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->_retvalue = $smarty_var;\n } else {\n \t// used for array reset,next,prev,end,current \n \t$this->last_variable = $this->yystack[$this->yyidx + 0]->minor['var'];\n \t$this->last_index = $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n \tif (isset($this->compiler->local_var[$this->yystack[$this->yyidx + 0]->minor['var']])) {\n $this->_retvalue = '$_smarty_tpl->tpl_vars['. $this->yystack[$this->yyidx + 0]->minor['var'] .']->value'.$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n \t} else {\n $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + 0]->minor['var'] .')->value'.$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n \t}\n \t$this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor['var'],\"'\"), null, true, false)->nocache;\n }\n }", "function yy_r9(){\n if ($this->php_handling == Smarty::PHP_PASSTHRU) {\n\t\t\t\t\t $this->_retvalue = new _smarty_text($this, '<<?php ?>%');\n } elseif ($this->php_handling == Smarty::PHP_QUOTE) {\n $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));\n }elseif ($this->php_handling == Smarty::PHP_ALLOW) {\n if ($this->asp_tags) {\n $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<%', true));\n } else {\n $this->_retvalue = new _smarty_text($this, '<<?php ?>%');\n }\n }elseif ($this->php_handling == Smarty::PHP_REMOVE) {\n if ($this->asp_tags) {\n $this->_retvalue = new _smarty_text($this, '');\n } else {\n $this->_retvalue = new _smarty_text($this, '<<?php ?>%');\n }\n }\n }", "function yy_r196()\n {\n $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + - 1]->minor);\n }", "function yy_r193()\n {\n $this->_retvalue = new _smarty_code($this, '(string)$_smarty_tpl->tpl_vars[\\'' . substr($this->yystack[$this->yyidx + 0]->minor, 1) . '\\']->value');\n }", "function yy_r11(){if ($this->lex->strip) {\n $this->_retvalue = new _smarty_text($this, preg_replace('![\\$this->yystack[$this->yyidx + 0]->minor ]*[\\r\\n]+[\\$this->yystack[$this->yyidx + 0]->minor ]*!', '', self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor)));\t\n } else {\n $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));\t\n }\n }", "function yy_r12(){ $this->compiler->tag_nocache = true; $this->is_xml = true; $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode(\"<?php echo '<?xml';?>\", $this->compiler, true)); }", "function yy_r124(){$this->_retvalue = array('var'=>$this->yystack[$this->yyidx + -1]->minor, 'smarty_internal_index'=>$this->yystack[$this->yyidx + 0]->minor); }", "function yy_r6()\n {\n $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor);\n }", "function yy_r116(){ if ($this->yystack[$this->yyidx + -2]->minor['var'] == '\\'smarty\\'') { $this->_retvalue = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index']).'::'.$this->yystack[$this->yyidx + 0]->minor;} else {\n $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor['var'] .')->value'.$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index'].'::'.$this->yystack[$this->yyidx + 0]->minor; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor['var'],\"'\"), null, true, false)->nocache;} }", "function yy_r10(){\n if ($this->php_handling == Smarty::PHP_PASSTHRU) {\n\t\t\t\t\t $this->_retvalue = new _smarty_text($this, '%<?php ?>>');\n } elseif ($this->php_handling == Smarty::PHP_QUOTE) {\n $this->_retvalue = new _smarty_text($this, htmlspecialchars('%>', ENT_QUOTES));\n }elseif ($this->php_handling == Smarty::PHP_ALLOW) {\n if ($this->asp_tags) {\n $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('%>', true));\n } else {\n $this->_retvalue = new _smarty_text($this, '%<?php ?>>');\n }\n }elseif ($this->php_handling == Smarty::PHP_REMOVE) {\n if ($this->asp_tags) {\n $this->_retvalue = new _smarty_text($this, '');\n } else {\n $this->_retvalue = new _smarty_text($this, '%<?php ?>>');\n }\n }\n }" ]
[ "0.7500225", "0.7438444", "0.72711855", "0.7250976", "0.7237945", "0.71659386", "0.71651137", "0.715692", "0.71512395", "0.7150674", "0.713909", "0.7102319", "0.7096271", "0.7075107", "0.70494634", "0.7038153", "0.7029849", "0.7019682", "0.69810945", "0.69742405", "0.696058", "0.69428366", "0.6941629", "0.69369346", "0.6929388", "0.69155204", "0.6915269", "0.6891417", "0.686849", "0.6863607" ]
0.7466633
1
Return the context formated for DynamoDB
public function getForDynamoDB() { $parameters = parent::getForDynamoDB(); $count = $this->count; if (null !== $count) { $parameters['Count'] = $count; } $limit = $this->limit; if (null !== $limit) { $parameters['Limit'] = $limit; } $exclusiveStartKey = $this->exclusiveStartKey; if (null !== $exclusiveStartKey) { $parameters['ExclusiveStartKey'] = $exclusiveStartKey; } return $parameters; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getForDynamoDB()\n {\n $action = $this->getAction();\n $value = $this->getValue();\n\n $parameters['Action'] = $action;\n if (isset($value)) {\n $parameters['Value'] = $value->getForDynamoDB();\n }\n\n return $parameters;\n }", "public function toLogContext();", "public function context();", "public function context();", "public function getContext();", "public function getContext();", "public function getContext();", "public function getContext();", "public function getContext();", "public function getContext();", "public function &context();", "private static function contextToString($context)\n {\n $export = '';\n foreach ($context as $key => $value) {\n $export .= \"{$key}: \";\n $export .= preg_replace(array(\n '/=>\\s+([a-zA-Z])/im',\n '/array\\(\\s+\\)/im',\n '/^ |\\G /m'\n ), array(\n '=> $1',\n 'array()',\n ' '\n ), str_replace('array (', 'array(', var_export($value, true)));\n $export .= \"\\t\";\n }\n return str_replace(array('\\\\\\\\', '\\\\\\''), array('\\\\', '\\''), rtrim($export));\n }", "public function getContextIdentifier();", "abstract protected function getContext();", "public function getContextData($context)\n {\n return $this->getConfig(\"contexts.{$context}\");\n }", "public function getContextId()\n {\n return $this->context_id;\n }", "public function getContext()\n\t{\n\t\t$this->rewind();\n\t\t$info = parent::getInfo();\n\n\t\treturn isset( $info['context'] )\n\t\t\t? $info['context']\n\t\t\t: '';\n\t}", "public function getContextFields();", "public function get_context(): \\context {\n return $this->context;\n }", "public function context(): array;", "public function getContext()\r\n {\r\n return $this->context;\r\n }", "public function getContext()\r\n {\r\n return $this->context;\r\n }", "public function context() {\n return context::instance_by_id($this->contextid);\n }", "protected function getContext()\n {\n return $this->context;\n }", "public function getContext()\n {\n return $this->context;\n }", "public function getContext()\n {\n return $this->context;\n }", "public function getContext()\n {\n return $this->context;\n }", "public function getContext()\n {\n return $this->context;\n }", "public function getContext()\n {\n return $this->context;\n }", "public function getContext()\n {\n return $this->context;\n }" ]
[ "0.60788554", "0.5844269", "0.5721941", "0.5721941", "0.5675982", "0.5675982", "0.5675982", "0.5675982", "0.5675982", "0.5675982", "0.56718165", "0.55963784", "0.5538077", "0.5491982", "0.5450505", "0.5317337", "0.5312312", "0.52898824", "0.5282447", "0.5244723", "0.5241332", "0.5241332", "0.52168417", "0.51635706", "0.51574606", "0.51574606", "0.51574606", "0.51574606", "0.51574606", "0.51574606" ]
0.6015391
1
Creates a new Contacts model. If creation is successful, the browser will be redirected to the 'view' page.
public function actionCreate() { $model = new Contacts(); if ($model->load(Yii::$app->request->post())) { $model->user_id = Yii::$app->user->identity->id; if($model->save()){ return $this->redirect(['view', 'id' => $model->contact_id]); } } return $this->render('create', [ 'model' => $model, ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionCreate()\r\n\t{\t\t\r\n\t\t$model=new Contacts;\r\n\t\t$settings=UserSettings::model()->findByAttributes(array('user_id'=>Yii::app()->user->id));\t\t\t\r\n\t\t$timezone = Timezone::model()->findByAttributes(array('id'=>$settings->timezone));\r\n\t\tdate_default_timezone_set($timezone->timezone);\t\r\n\t\t$model->created_by\t= Yii::app()->user->id;\r\n\t\t$model->created_at\t= date('Y-m-d H:i:s');\r\n\t\t$model->status\t\t= 1;\r\n\r\n\t\t// Uncomment the following line if AJAX validation is needed\r\n\t\t// $this->performAjaxValidation($model);\r\n\r\n\t\tif(isset($_POST['Contacts']))\r\n\t\t{\r\n\t\t\t$model->attributes=$_POST['Contacts'];\r\n\t\t\tif($model->save()){\r\n\t\t\t\tif(isset($model->group) and count($model->group)>0){\r\n\t\t\t\t\tforeach($model->group as $group){\r\n\t\t\t\t\t\t$list\t= new ContactsList;\r\n\t\t\t\t\t\t$list->contact_id\t= $model->id;\r\n\t\t\t\t\t\t$list->group_id\t\t= $group;\r\n\t\t\t\t\t\t$list->save();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t$this->redirect(array('index'));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$this->render('create',array(\r\n\t\t\t'model'=>$model,\r\n\t\t));\r\n\t}", "public function create()\n {\n return view ('contacts.create');\n }", "public function actionCreate()\n {\n $model = new Contact();\n \n if ($model->load(Yii::$app->request->post())) {\n \n if($model->order == ''){\n $model->order = 0;\n }\n \n $array = ['北京','上海','重庆','天津','北京(总部)','北京(总部)'];\n \n if(in_array($model->city, $array)){\n $model->initial = '1';\n \n $model->save();\n }else{\n $model->initial = $this->_getFirstCharter($model->province);\n $model->save();\n }\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function create()\n {\n return view('contacts.create');\n }", "public function create()\n {\n return view('contacts.create');\n }", "public function create()\n {\n return view('contacts.create');\n }", "public function create()\n {\n return view('contacts.create');\n }", "public function create()\n {\n return view('contacts.create');\n }", "public function create() {\n $data['title'] = 'Create a Contact';\n $data['hno'] = array (\n 'd' => 'Down', \n 'u' => 'Unreachable', \n 'r' => 'Recovery', \n 'f' => 'Flapping', \n 's' => 'Scheduled Downtime', \n 'n' => 'None'\n );\n $data['sno'] = array (\n 'w' => 'Warning', \n 'u' => 'Unknown', \n 'c' => 'Critical', \n 'r' => 'Recovery', \n 'f' => 'Flapping', \n 'n' => 'None'\n );\n return View::make('contacts.form', $data);\n\t}", "public function createAction()\n {\n\n if (!$this->request->isPost()) {\n return $this->dispatcher->forward(array(\n \"controller\" => \"contact\",\n \"action\" => \"index\"\n ));\n }\n\n $contact = new Contact();\n\n //$contact->id = $this->request->getPost(\"id\");\n $contact->name = $this->request->getPost(\"name\");\n $contact->email = $this->request->getPost(\"email\", \"email\");\n $contact->content = $this->request->getPost(\"content\");\n\n \n\n if (!$contact->save()) {\n foreach ($contact->getMessages() as $message) {\n $this->flash->error($message);\n }\n return $this->dispatcher->forward(array(\n \"controller\" => \"contact\",\n \"action\" => \"new\"\n ));\n }\n\n $this->flash->success(\"contact was created successfully\");\n return $this->dispatcher->forward(array(\n \"controller\" => \"contact\",\n \"action\" => \"index\"\n ));\n\n }", "public function create()\n {\n return view('healthcarecontacts.create');\n }", "public function create()\n\t{\n\t\t$pagetitle = \"Create Contact\";\n\t\t\n\t\t$position = Contact::select_position();\n\t\t$companies = Contact::select_approvedcompanies();\n\t\t$cities = City::selectCity();\t\n\t\treturn View::make('contact.create', compact('pagetitle', 'position', 'companies', 'cities'));\n\t}", "public function create()\n {\n return view('User.createContact');\n }", "public function create()\n {\n $categories = Contactcategorie::all();\n return $this->view_('contact.update',[\n 'object'=> new Contact(),\n 'categories'=>$categories\n ]);\n }", "public function create()\n {\n return view('manage.contact.create');\n }", "public function create()\n {\n $companies = Company::all();\n return view('contacts.create', compact('companies'));\n }", "public function create()\n {\n return view('user.contact.create');\n }", "public function create()\n {\n return view('contact.create');\n }", "public function create()\n {\n return view('contact.create');\n }", "public function create()\n {\n return view('contact.create');\n }", "public function create()\n {\n return view('contact.create');\n }", "public function create()\n {\n return view('contact.create');\n }", "public function actionContact() {\n $model = new Contact;\n if (isset($_POST['Contact'])) {\n $model->attributes = $_POST['Contact'];\n if ($model->validate()) {\n $model->save();\n Yii::app()->user->setFlash('contact', 'Gửi thông tin liên hệ thành công. Chúng tôi sẽ trả lời bạn trong thời gian sớm nhất có thể. Trân trọng!');\n $this->refresh();\n } else {\n var_dump($model->getErrors());\n }\n }\n $this->render('contact', array('model' => $model));\n }", "public function create()\n {\n // return view('contact.create');\n return view('index');\n }", "public function getInsertContacts()\n {\n return view('v1.create');\n }", "public function create()\n {\n return view('contact::create');\n }", "public function create()\n {\n return view('contacts.create',[\n 'creator_id'=>auth()->user()->id,\n ]);\n }", "public function actionCreate()\n {\n $model = new Customer();\n\n if ($model->load(Yii::$app->request->post()) ) {\n\n if( $model->create()){\n $model->sendSuccess();\n return $this->redirect(['index']);\n }else{\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Person();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id_person]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate() {\n $model = new Forms();\n\n if ($this->request->isPost) {\n if ($model->load($this->request->post())) {\n $model->save();\n\n return $this->redirect(['view', 'id' => $model->id]);\n }\n } else {\n $model->loadDefaultValues();\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }" ]
[ "0.8234837", "0.7369525", "0.7316907", "0.73134357", "0.73134357", "0.73134357", "0.73134357", "0.73134357", "0.72263634", "0.72099507", "0.71702147", "0.7145576", "0.7118914", "0.71176326", "0.7085711", "0.70790625", "0.70381844", "0.69748", "0.69748", "0.69748", "0.69748", "0.69748", "0.6959676", "0.6955148", "0.6897839", "0.68932945", "0.6886696", "0.6879319", "0.6878755", "0.68353766" ]
0.8748364
0
Updates an existing Contacts model. If update is successful, the browser will be redirected to the 'view' page.
public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post())) { $model->user_id = Yii::$app->user->identity->id; if($model->save()){ return $this->redirect(['view', 'id' => $model->contact_id]); } } return $this->render('update', [ 'model' => $model, ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateAction(){\n\t\t$id = Input::get('id');\n\t\t$name = Input::get('name');\n\t\t$mobile = Input::get('mobile');\n\t\t$phone = Input::get('phone');\n\t\t\n\t if (Input::server(\"REQUEST_METHOD\") == \"POST\"){\n\t \t$rules = array( \n\t\t\t\t'client' => 'required|min:1',\n 'name' => 'required|min:1',\n\t\t\t\t'mobile' => 'required|min:6'\n \t\t\t);\n \t\t\t$validator = Validator::make(Input::all(), $rules);\n\n\t if ($validator->fails()){\t\t\n\t\t \treturn Redirect::route('admin/clientcontact_edit', array('id'=>$id))->withErrors($validator);\n\t } else {\n // validation ok\n\t try {\n\t //save on db/*\n\t\t\t\t\t$contact = ClientContact::find($id);\n\t\t $contact->name = $name;\n\t\t $contact->mobile = $mobile;\n\t\t $contact->phone = $phone;\n\t\t $contact->save(); \n\n\t\t\t\t\tSession::flash('status_success', 'Successfully Updated.');\n\t\t\t\t\treturn Redirect::route('admin/clientcontacts', array('id'=>$id));\n\t } catch( Exception $e ) {\n\t Session::flash('status_error', 'An error occurred while creating a new account - please try again.');\n\t return Redirect::route('admin/clientcontact_edit', array('id'=>$id));\n\t } \t \n\t }\n\t\t}\n\t}", "public function actionUpdate()\n {\n $model = $this->findModel(Yii::$app->user->id);\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['update']);\n } else {\n return $this->render('update', [\n 'model' => $model,\n ]);\n }\n }", "public function updateAction() {\n // if the page has no post \n // then redirect to 404\n if (empty($_POST)) {\n $this->show404();\n return;\n }\n // get the post id \n $id = $_POST[\"id\"];\n // validate other contacts data\n $contactDetails = $this->validateInput();\n\n // validate id is int and token\n if (filter_var($id, FILTER_VALIDATE_INT) === false ||\n $this->validateToken() === false) {\n //set error message\n $_SESSION[\"error_message\"] = \"Invalid Data supplied\";\n // redirect to show all contacts\n header(\"Location: /contacts\");\n return;\n }\n\n $contact_obj = new Contact();\n // update contacts table from post\n $result = $contact_obj->updateContact($contactDetails, $id);\n\n // show message depends on result from DB\n if ($result == true) {\n $_SESSION[\"success_message\"] = \"Contact updated successfully\";\n } else {\n $_SESSION[\"error_message\"] = \"Failed to update Contact\";\n }\n // redirect to show all contacts\n header(\"Location: /contacts\");\n }", "public function actionUpdate($id){\n\t\t\t$model = $this->findModel($id);\n\t\t\t\n if ($model->load(Yii::$app->request->post())){\n\t\t\t\n\t\t\t$year = $_POST['year'];\n\t\t\t$day = $_POST['day'];\n\t\t\t$month = $_POST['month'];\n\t\t\t$model->updated_at = date('Ydmh');\n\t\t\t$model->bod = $year.'-'.$month.'-'.$day;\n\t\t\t$model->save(false);\n\t\t\n\t\t\n\t\t\t\n\t\t\t$modelsContact = Model::createMultiple(UserContact::classname());\n\t\t\tModel::loadMultiple($modelsContact, Yii::$app->request->post());\n\t\t\t\n\t\t\tforeach ($modelsContact as $con => $modelContact):\n\t\t\t\t\n\t\t\t\tif($modelContact->contact_number != \"\"){\n\t\t\t\t\t\n\t\t\t\t\t$modelContact->iduser = $model->id;\t\t\t\t\n\t\t\t\t\t$modelContact->save(false);\n\t\t\t\t}\n\t\t\tendforeach;\n\t\t\n\t\t\treturn $this->redirect(['profile']);\t\t\t\n } else {\n return $this->render('update', [\n 'model' => $model,\n\t\t\t\t'modelsContact' => (empty($modelsContact)) ? [new UserContact] : $modelsContact,\n ]);\n }\n }", "public function editContact(){\n\t\t\n\t\t//echo $this->input->post('query_id');\n\t\t//echo $this->input->post('url');\n\t\t\n\t\t//die;\n\t\t$this->load->model('admin/Users_model', 'user');\n\t\t$isUserEdited = $this->user->editContactDetails();\n\t\tif ( $isUserEdited ){\n\t\t\t$this->session->set_flashdata('msg', 'User updated successfully.');\n\t\t}else{\n\t\t\t$this->session->set_flashdata('msg', 'Oops! user can not be updated.');\n\t\t}\n\n\t\tredirect(base_url().'admin/'.$this->input->post('url').'/'.$this->input->post('query_id'));\n\n\n\t}", "function update($id = null) {\n\t\t$this->layout = \"ajax\";\n \t\tConfigure::write('debug', '0');\n\n\t\tif (!empty($this->data)) {\n\t\t\t$this->Contacts->create();\n\t\t\t$this->Contacts->save($this->data);\n\t\t\t$contact_id = $this->Contacts->id;\n\t\t\t$this->set('success', '{success:true,contact_id:'.$contact_id.'}');\n\t\t}\n\t\telse {\n\t\t\t$this->set('success', '{success:false}');\n\t\t}\t\t\n\t}", "public function actionUpdate($id)\r\n\t{\r\n\t\t$model=$this->loadModel($id);\r\n\t\t\r\n\t\t$criteria\t\t\t\t= new CDbCriteria;\r\n\t\t$criteria->condition\t= '`contact_id`=:contact_id';\r\n\t\t$criteria->params\t\t= array(':contact_id'=>$id);\r\n\t\t$criteria->select\t\t= '`group_id`';\r\n\t\t$lists\t\t\t\t\t= ContactsList::model()->findAll($criteria);\r\n\t\t\r\n\t\t$currentgroups\t= array();\r\n\t\tforeach($lists as $list){\r\n\t\t\t$currentgroups[]\t= $list->group_id;\r\n\t\t}\r\n\t\t\r\n\t\t$model->group\t\t= $currentgroups;\r\n\r\n\t\t// Uncomment the following line if AJAX validation is needed\r\n\t\t// $this->performAjaxValidation($model);\r\n\r\n\t\tif(isset($_POST['Contacts']))\r\n\t\t{\r\n\t\t\t$model->attributes=$_POST['Contacts'];\r\n\t\t\tif($model->save()){\r\n\t\t\t\t$newgroups\t= array();\r\n\t\t\t\tif(isset($_POST['groups']) and count($_POST['groups'])>0){\r\n\t\t\t\t\t$newgroups\t= $model->group;\r\n\t\t\t\t\tforeach($newgroups as $group){\r\n\t\t\t\t\t\tif(!in_array($group, $currentgroups)){\r\n\t\t\t\t\t\t\t$list\t= new ContactsList;\r\n\t\t\t\t\t\t\t$list->contact_id\t= $model->id;\r\n\t\t\t\t\t\t\t$list->group_id\t\t= $group;\r\n\t\t\t\t\t\t\t$list->save();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$removegroups\t= array_diff($currentgroups, $newgroups);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t$criteria\t\t= new CDbCriteria;\r\n\t\t\t\t$criteria->condition\t= '`contact_id`=:contact_id';\r\n\t\t\t\t$criteria->params\t\t= array(':contact_id'=>$model->id);\r\n\t\t\t\t$criteria->addInCondition('`group_id`', $removegroups);\r\n\t\t\t\tContactsList::model()->deleteAll($criteria);\r\n\t\t\t\t\r\n\t\t\t\t$this->redirect(array('index'));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$this->render('update',array(\r\n\t\t\t'model'=>$model,\r\n\t\t));\r\n\t}", "public function update($id) {\n $c = Contact::find($id);\n $c->contact_name = Input::get('contact_name');\n $c->alias = Input::get('alias');\n $c->host_notifications_enabled = Input::get('host_notifications_enabled');\n $c->service_notifications_enabled = Input::get('service_notifications_enabled');\n $c->host_notification_period = Input::get('host_notification_period');\n $c->service_notification_period = Input::get('service_notification_period');\n $c->host_notification_options = implode(\",\", Input::get('host_notification_options'));\n $c->service_notification_options = implode(\",\", Input::get('service_notification_options'));\n $c->host_notification_commands = Input::get('host_notification_commands');\n $c->service_notification_commands = Input::get('service_notification_commands');\n $c->email = Input::get('email');\n if ($c->save()) {\n Session::flash('message', 'Successfully updated contact!');\n return Redirect::to('contacts');\n } else {\n return Redirect::route('contacts.edit')\n ->withErrors($c->errors());\n }\n\t}", "public function actionUpdate($id)\n {\n $model = $this->findModel($id);\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('update', [\n 'model' => $model,\n 'contacts' => Contact::getNameIndex(),\n 'cancelUrl' => Url::to(['/bank-account/view', 'id' => $id])\n ]);\n }", "public function actionUpdate()\n {\n /** @var User $model */\n $model = $this->loadOrCreateModel('content\\models\\User');\n\n if ($model->load($_POST)) {\n if ($model->save()) {\n $this->flash = \"{$model->name} successful saved\";\n return $this->redirect(['index']);\n }\n $this->errorFlash = 'Error saving';\n }\n\n\n $this->pageTitle = $model->isNewRecord ? 'Create new ' : ('Edit ' . $model->name);\n return $this->render('update', [\n 'model' => $model,\n ]);\n }", "public function editAction()\n {\n $contactId = (int)$this->getRequest()->getParam('id');\n $contact = $this->_initAction();\n if ($contactId && ! $contact->getId()) {\n $this->_getSession()->addError(\n Mage::helper('ddg')->__('This contact no longer exists.')\n );\n $this->_redirect('*/*/');\n\n return;\n }\n\n $contactEmail = Mage::getModel('ddg_automation/apiconnector_contact')\n ->syncContact();\n if ($contactEmail) {\n Mage::getSingleton('adminhtml/session')->addSuccess(\n 'Successfully synced : ' . $contactEmail\n );\n }\n\n Mage::dispatchEvent(\n 'email_contact_controller_edit_action', array('contact' => $contact)\n );\n\n $this->_redirect('*/*');\n }", "public function updatecontact(Request $request)\n {\n $editcontact = Admin::find(1);\n $editcontact->emailcompany = $request->emailcompany;\n $editcontact->tel = $request->tel;\n $editcontact->fax = $request->fax;\n $editcontact->background_color = $request->background_color;\n $editcontact->save();\n return redirect()->back()->with(['message'=>'Changes Saved']);\n }", "public function actionUpdate()\r\n\t{\r\n\t\tparent::actionUpdate();\r\n\t $id=$_POST['id'];\r\n\t $model=$this->loadModel($id[0]);\r\n\t\t$this->lookupdata();\r\n\t if ($model != null)\r\n {\r\n if ($this->CheckDataLock($this->menuname, $id[0]) == false)\r\n {\r\n $this->InsertLock($this->menuname, $id[0]);\r\n\t\t echo CJSON::encode(array(\r\n\t\t\t 'status'=>'success',\r\n\t\t\t 'addressbookid'=>$model->addressbookid,\r\n\t\t\t 'fullname'=>$model->fullname,\r\n\t\t\t 'taxno'=>$model->taxno,\r\n\t\t\t 'recordstatus'=>$model->recordstatus,\r\n\t\t\t 'div'=>$this->renderPartial('_form', array('model'=>$model,\r\n\t\t\t 'bankaddress'=>$this->bankaddress,\r\n\t\t\t 'bankcontact'=>$this->bankcontact,\r\n 'accpiutang'=>$this->accpiutang), true)\r\n\t\t\t ));\r\n\t\t Yii::app()->end();\r\n }\r\n\t }\r\n\t}", "public function actionUpdate()\n {\n $modelList = $this->viewList('models');\n $model = new UpdateCar();\n $car = $this->viewOne('car');\n\n if($this->update($model,$car)){\n $this->setFlash('success','car update success');\n }\n\n return $this->render('update',['model' => $model,'car' => $car,'modelList' => $modelList]);\n }", "public function actionUpdate()\n\t{\n\t\t$model=$this->loadModel();\n\t\tif(isset($_POST['Post']))\n\t\t{\n\t\t\t$model->attributes=$_POST['Post'];\n\t\t\tif($model->save())\n\t\t\t\t$this->redirect(array('view','id'=>$model->id));\n\t\t}\n\n\t\t$this->render('update',array(\n\t\t\t'model'=>$model,\n\t\t));\n\t}", "public function actionUpdate()\n\t{\n\t\t$model=$this->loadModel();\n\n\t\tif(isset($_POST['User']))\n\t\t{\n\t\t\t$model->attributes=$_POST['User'];\n\t\t\tif($model->save())\n\t\t\t\t$this->redirect(array('/user/admin'));\n\t\t}\n\n\t\t$this->render('update',array(\n\t\t\t'model'=>$model,\n\t\t));\n\t}", "public function update(){\n $id = request()->id;\n /** Use the variable to find the entry to update and save date */\n $data = Contact::find($id);\n $data->fullname = request()->fullname;\n $data->email = request()->email;\n $data->phone = request()->phone;\n $data->subject = request()->subject;\n $data->message = request()->message;\n $data->save();\n\n /** Return a json response object */\n return response()->json(['message' , 'Data Updated Successfully']);\n }", "public function update(Request $request, $id)\n {\n $contact = Contact::find($id);\n\n $contact->name = $request->nombre;\n $contact->apellido = $request->apellido;\n $contact->email = $request->correo;\n $contact->numbercontact = $request->numbercontact;\n\n if($contact->save()){\n\n return redirect('/');\n }else{\n\n \treturn view('contacts.create');\n }\n }", "public function update_contact_info() {\r\n\t\tif ($this->contact_info_validation() == TRUE) {\r\n\t\t\t$userData = array(\r\n\t\t\t\t\t'FIRST_NM' => $this->input->post('firstName'),\r\n\t\t\t\t\t'LAST_NM' => $this->input->post('lastName'),\r\n\t\t\t\t\t'EMAIL_ADDR' => $this->input->post('email'),\r\n\t\t\t\t\t'STREET_NUM' => $this->input->post('address'),\r\n\t\t\t\t\t'STREET_NM' => $this->input->post('apt_num'),\r\n\t\t\t\t\t'STATE_CD' => $this->input->post('state'),\r\n\t\t\t\t\t'ZIP_CD' => $this->input->post('zip')\t\t\t\t\t\r\n\t\t\t);\r\n\t\t\t\t\t\t\r\n\t\t\t\r\n\t\t\t$this->load->model('User_model');\r\n\t\t\t$user_updated= $this->User_model->update_user($userData);\r\n\t\t\t\r\n\t\t\tif ($user_updated) {\r\n\t\t\t\t$this->load_success();\r\n\t\t\t} else {\r\n\t\t\t\t$this->load_error();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t$this->load_edit_contact_info();\r\n\t\t}\r\n\t\t\r\n\t}", "public function update(Request $request, $id)\n {\n $contacts = Contacts::findOrFail($id);\n $contacts->name = $request->name;\n $contacts->email = $request->email;\n $contacts->phone = $request->phone;\n $contacts->user_id = $request->user_id;\n $contacts->instruction = $request->instruction;\n $contacts->address_address = $request->address_address;\n $contacts->address_latitude = $request->address_latitude;\n $contacts->address_longitude = $request->address_longitude;\n\n if ($contacts->update()){\n\n return redirect()->route('contacts.show', $id);\n }else {\n session::flash('Fuck');\n return redirect()->route('contacts.edit', $id);\n }\n\n }", "public function actionUpdate($id)\n {\n $model = $this->findModel($id);\n $area = new Area();\n\n // if (Yii::$app->request->isAjax) {\n // Yii::$app->response->format = \\yii\\web\\Response::FORMAT_JSON;\n // return \\yii\\bootstrap\\ActiveForm::validate($model);\n // }\n $params = Yii::$app->request->post();\n $mobile_phone = AdviserContact::find()->select('info')->where(['adviser_id' => $id, 'type' => 'phone'])->asArray()->all();\n $email = AdviserContact::find()->select('info')->where(['adviser_id' => $id, 'type' => 'email'])->asArray()->all();\n if ($model->load(Yii::$app->request->post())) {\n $model->setAttribute('update_time', time());\n if ($model->save()) {\n AdviserContact::deleteAll(['adviser_id' => $id]);\n if (isset($params['mobile_phone'])) {\n foreach ($params['mobile_phone'] as $mobile_phone) {\n $adviser_contact = new AdviserContact();\n $adviser_contact->adviser_id = $model->id;\n $adviser_contact->info = $mobile_phone;\n $adviser_contact->type = 'phone';\n $adviser_contact->save();\n }\n }\n if (isset($params['email'])) {\n foreach ($params['email'] as $email) {\n $adviser_contact = new AdviserContact();\n $adviser_contact->adviser_id = $model->id;\n $adviser_contact->info = $email;\n $adviser_contact->type = 'email';\n $adviser_contact->save();\n }\n }\n return $this->redirect(['view', 'id' => $model->id]);\n }\n }\n\n return $this->render('update', [\n 'model' => $model,\n 'mobile_phone' => $mobile_phone,\n 'email' => $email,\n 'area' => $area,\n ]);\n }", "public function actionUpdate($id)\r\n\t{\r\n\t\t$model=$this->loadModel($id);\r\n\r\n\t\t// Uncomment the following line if AJAX validation is needed\r\n\t\t// $this->performAjaxValidation($model);\r\n\r\n\t\tif(isset($_POST['Contencao']))\r\n\t\t{\r\n\t\t\t$model->attributes=$_POST['Contencao'];\r\n\t\t\tif($model->save())\r\n\t\t\t\t$this->redirect(array('view','id'=>$model->contencao_id));\r\n\t\t}\r\n\r\n\t\t$this->render('update',array(\r\n\t\t\t'model'=>$model,\r\n\t\t));\r\n\t}", "public function update(Request $request, $id)\n {\n\n $validatedData = $request->validate([\n 'new_contact_firstname' => 'required|max:30',\n 'new_contact_lastname' => 'required|max:30',\n 'new_contact_email' => 'required|email',\n 'new_contact_phone' => 'required|regex:/(\\+1)[0-9]{10}/'\n ]);\n\n // Create the new conttact\n $c = \\App\\Contacts::find($id);\n $c->firstname = $request->input('new_contact_firstname');\n $c->lastname = $request->input('new_contact_lastname');\n $c->email = $request->input('new_contact_email');\n $c->phone = $request->input('new_contact_phone');\n $c->save();\n\n\n // messaging\n $request->session()->flash('status', 'Contact updated!');\n // redirect\n return redirect()->route('contacts.index');\n }", "public function update()\n {\n $data = array(\n 'first_name' => $this->input->post('first_name'),\n 'last_name' => $this->input->post('last_name'),\n 'tel' => $this->input->post('tel'),\n 'email' => $this->input->post('email'),\n 'address' => $this->input->post('address'),\n );\n $this->db->where('id', $this->input->post('id'));\n $this->db->update('customers', $data);\n }", "public function update_contact($id)\n {\n $data['address'] = $this->input->post('address');\n $data['phone'] = $this->input->post('phone');\n $data['phone2'] = $this->input->post('phone2');\n $data['email'] = $this->input->post('email');\n $data['email2'] = $this->input->post('email2');\n\n $data['update_by'] = $this->session->userdata('user_username');\n $data['update_date'] = date('d-m-Y H:i:s');\n $data['status'] = 1;\n\n $this->db->where('id', $id)->update('tbl_contact', $data);\n if($this->db->affected_rows()){\n return true;\n }\n else{\n return false;\n }\n }", "public function actionUpdate($id)\n\t{\n\t\t$model=$this->loadModel($id);\n\n\t\t// Uncomment the following line if AJAX validation is needed\n\t\t// $this->performAjaxValidation($model);\n\n\t\tif(isset($_SESSION[\"login_admin\"]) && isset($_POST['Customer']))\n\t\t{\n\t\t\t$model->attributes=$_POST['Customer'];\n\t\t\tif($model->save())\n\t\t\t\t$this->redirect('?r=admin/manageCustomers');\n\t\t}\n\n\n\t\tif(isset($_POST['Customer']))\n\t\t{\n\t\t\t$model->attributes=$_POST['Customer'];\n\t\t\tif($model->save())\n\t\t\t\t$this->redirect(array('view','id'=>$model->id));\n\t\t}\n\t\t\n\t\t$this->render('update',array(\n\t\t\t'model'=>$model,\n\t\t));\n\t}", "function edit($id)\n { \n // check if the contact exists before trying to edit it\n $data['contact'] = $this->Contact_model->get_contact($id);\n \n if(isset($data['contact']['id']))\n {\n $this->load->library('form_validation');\n\n\t\t\t$this->form_validation->set_rules('email','Email','required|max_length[255]|valid_email');\n\t\t\t$this->form_validation->set_rules('text','Text','required');\n\t\t\n\t\t\tif($this->form_validation->run()) \n { \n $params = array(\n\t\t\t\t\t'email' => $this->input->post('email'),\n\t\t\t\t\t'time' => date('Y-m-d H:i:s'),\n\t\t\t\t\t'text' => $this->input->post('text'),\n );\n\n $this->Contact_model->update_contact($id,$params); \n redirect('contact/index');\n }\n else\n {\n $data['_view'] = 'contact/edit';\n $this->load->view('layouts/main',$data);\n }\n }\n else\n show_error('The contact you are trying to edit does not exist.');\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'title' => 'required',\n 'name' => 'required',\n 'email' => 'required',\n 'address' => 'required',\n \n ]);\n\n $contact = Contact::find($id);\n\n if(auth()->user()->id != $contact->user_id){\n return redirect('/contacts')->with('error', 'Unauthorized page');\n }\n $contact->title = $request->input('title');\n $contact->name = $request->input('name');\n $contact->company_name = $request->input('company_name');\n $contact->job_title = $request->input('job_title');\n $contact->email = $request->input('email');\n $contact->phone_number = $request->input('phone_number','No number');\n $contact->mobile_number = $request->input('mobile_number','No number');\n $contact->address = $request->input('address');\n $contact->notes = $request->input('notes');\n $contact->save();\n\n\n\n return redirect('/contacts')->with('success', 'Contact Updated');\n }", "public function actionUpdate()\n {\n $id = Yii::$app->request->post(\"id\");\n $model = $this->findModel($id);\n $dates = Yii::$app->request->post(\"dates\", \"\");\n $content = Yii::$app->request->post(\"content\", \"\");\n $model->dates = $dates;\n $model->content = $content;\n\n if ($model->validate() && $model->save()) {\n return json_encode(['code' => 200]);\n// return $this->redirect(['view', 'id' => $model->course_id]);\n } else {\n return json_encode(['code' => 20]);\n// return $this->render('update', [\n// 'model' => $model,\n// ]);\n }\n }", "public function getUpdateContact(Request $request, $contact_id)\n {\n \t$contact = Contact::find($contact_id);\n \t(new UpdateObjectValidator())->validate($contact, 'contact', $contact_id);\n \t$lookup_titles = (new TitleLookupRetriever())->execute();\n \t$lookup_marital_statuses = (new MaritalStatusLookupRetriever())->execute();\n \tif (Util::isValidRequestVariable($request->model_name))\n \t{\n \t\t$model_name = $request->model_name;\n \t}\n \telse\n \t{\n \t\t$model_name = \"none\";\n \t}\n \tif (Util::isValidRequestVariable($request->model_id))\n \t{\n \t\t$model_id = $request->model_id;\n \t}\n \telse\n \t{\n \t\t$model_id = \"none\";\n \t}\n \t$model_view_route = $this->getModelViewRoute($model_name, $model_id);\n \t$model_id_name = $this->getModelIdName($model_name);\n \t$link_description = $this->getLinkDescription($model_name);\n \treturn view('contact.update-contact', [\n \t\t'contact' => $contact, \n \t\t'lookup_titles' => $lookup_titles, \n \t\t'lookup_marital_statuses' => $lookup_marital_statuses,\n \t\t'model_name' => $model_name,\n \t\t'model_id' => $model_id,\n \t\t'model_view_route' => $model_view_route,\n \t\t'model_id_name' => $model_id_name,\n \t\t'link_description' => $link_description\n \t]);\n }" ]
[ "0.7119279", "0.70275563", "0.7012479", "0.68510175", "0.6832267", "0.66197675", "0.65692586", "0.65485215", "0.65378", "0.6531882", "0.64534485", "0.6391949", "0.6386817", "0.63814723", "0.6380907", "0.63696384", "0.6317574", "0.6309005", "0.6298113", "0.6292834", "0.6277894", "0.6273417", "0.6263318", "0.62603325", "0.62406427", "0.62333286", "0.6231666", "0.62201184", "0.62194717", "0.6195695" ]
0.7072643
1
Finds the Contacts model based on its primary key value. If the model is not found, a 404 HTTP exception will be thrown.
protected function findModel($id) { if (($model = Contacts::find()->where(['contact_id' => $id, 'user_id' => Yii::$app->user->identity->id])->one()) !== null) { return $model; } throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function loadModel($id)\r\n\t{\r\n\t\t$model=Contacts::model()->findByPk($id);\r\n\t\tif($model===null)\r\n\t\t\tthrow new CHttpException(404, Yii::t('app', 'The requested page does not exist.'));\r\n\t\treturn $model;\r\n\t}", "private function contact($id)\n\t{\n\t\tif(is_numeric($id)) {\n\t\t\t$Contact = Contact::find($id);\n\t\t\tif ($Contact) {\n\t\t\t\treturn $Contact;\n\t\t\t}\n\t\t}\n\n\t\t$query = Contact::where('external_key', $id);\n $count = $query->count();\n\n\t\tif (!$count) {\n\t\t\tresponse()->json([\n\t\t\t\t'status' => 'error',\n\t\t\t\t'data' => [],\n\t\t\t\t'messages' => ['Record not found'],\n\t\t\t])->send();\n\t\t\texit;\n\t\t}\n\n\t\tif ($count > 1) {\n\t\t\tresponse()->json([\n\t\t\t\t'status' => 'error',\n\t\t\t\t'data' => [],\n\t\t\t\t'messages' => ['Multiple records found'],\n\t\t\t])->send();\n\t\t\texit;\n\t\t}\n\n\t\treturn $query->first();\n\t}", "protected function findModel($id)\n {\n if (($model = Contact::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException('The requested page does not exist.');\n }", "public function loadModel($id) {\n $model = ContactUsers::model()->findByPk($id);\n if ($model === null)\n throw new CHttpException(404, 'The requested page does not exist.');\n return $model;\n }", "public function find($key): ?Model;", "public function contact($nameOrEmail)\n {\n if ($this->contacts === null) {\n $this->getContacts();\n }\n\n foreach ($this->contacts as $c) {\n if ($c->name == $nameOrEmail || $c->email == $nameOrEmail) {\n return $c;\n }\n }\n\n throw new Exceptions\\NotFoundException(\"Contact not found.\");\n }", "public function testFindContact()\n\t{\n\t\t$contact = Contact::find(\"3f73432a-2b95-4ae7-b5d6-79808e74c254\");\n\n\t\t/*\n\t\t|------------------------------------------------------------\n\t\t| Assertion\n\t\t|------------------------------------------------------------\n\t\t*/\n\t\t$this->assertTrue($contact->ContactID == \"3f73432a-2b95-4ae7-b5d6-79808e74c254\");\n\t}", "public function show($id)\n\t{\n\t\treturn Contact::findOrFail($id);\n\t}", "public function loadModel($id) {\n $model = Companies::findOne($id);\n if ($model === null)\n throw new CHttpException(404, 'The requested page does not exist.');\n return $model;\n }", "public function show($id)\n {\n return Contactos::findOrfail($id); \n }", "public function findOne($id) {\n $contact = Contact::findOrFail($id);\n broadcast(new ContactsRetrieved($contact));\n return response()->json('retrieved');\n }", "public function findContact($field, $value){\n\t\t\tif(isset($field)&&isset($value)){\n\t\t\t\t$this->query = \"SELECT * FROM contacts WHERE $field = '$value'\" or die(\"Error ...\".mysqli_error($this->myConnection));\n\t\t\t\t$result = $this->myConnection->query($this->query);\t\n\t\t\t\tif(isset($result)){\n\t\t\t\t\t//num_rows value =1 then an object has been retrieve from the contacts table\n\t\t\t\t\tif($result->num_rows == 1){\n\t\t\t\t\t\techo \"<table><tr><th>Firstname</th><th>Surname</th><th>Email</th><th>Mobile</th></tr>\";\n\t\t\t\t\t\twhile ($row = mysqli_fetch_array($result)){\n\t\t\t\t\t\t\techo \"<tr><td>\".$row[\"firstname\"].\"</td><td>\".$row[\"surname\"].\"</td><td>\".$row[\"email\"].\"</td><td id='tdM'>\".$row[\"mobile\"].\"</td></tr>\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\techo \"</table>\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//value entered doesn't exist so no object has been returned\n\t\t\t\tif($result->num_rows == 0){\n\t\t\t\t\techo strtoupper($value).\" could not be found!!!!!\";\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public function loadModel($id)\n\t{\n $model=Campaign::model()->findByPk($id);\n\t\t$organization_id = (int) Yii::app()->user->getState('organization_id');\n\t\tif($model===null || $model->organization_id != $organization_id)\n\t\t\tthrow new CHttpException(404,'The requested page does not exist.');\n\t\treturn $model;\n\t}", "public function find($model);", "public function findById($id)\n {\n foreach ($this as $contact) {\n /** @var SFContact $contact */\n if ($contact->Id == $id) {\n return $contact;\n }\n }\n\n return null;\n }", "public function findContact($contactId)\n {\n return $this->ploomesConfig->ODataObject\n ->from('Contacts')\n ->where('Id',$contactId)\n ->expand('Phones')\n ->first();\n }", "public function find($id)\n {\n return $this->model->findOrFail($id);\n }", "public function loadModel($id, $modelClass = __CLASS__) {\n $model = Mail::model()->findByPk($id);\n if ($model === null)\n throw new CHttpException(404, 'The requested page does not exist.');\n return $model;\n }", "public function find($id)\n {\n $rel = $this->currentOrClone();\n $modelClass = $this->modelClass;\n $tableName = $modelClass::tableName();\n $first = $rel->where([$tableName . '.' . $modelClass::primaryKey() => $id])->first();\n if (!$first) {\n throw new RecordNotFoundException(sprintf(\n \"Couldn't find %s with %s=%s\",\n $this->modelClass,\n $modelClass::primaryKey(),\n $id\n ));\n }\n return $first;\n }", "private function findModel($id)\n {\n $model=Post::model()->findByPk($id);\n if($model===null)\n throw new CHttpException(404,'The requested page does not exist.');\n return $model;\n }", "public function find(object $model);", "protected function findModel($id)\n {\n if (is_array($id)) {\n /** @var Comment $model */\n $model = Comment::findAll($id);\n } else {\n /** @var Comment $model */\n $model = Comment::findOne($id);\n }\n if ($model !== null) {\n return $model;\n } else {\n throw new HttpException(404);\n }\n }", "public function loadModel($id) {\r\n $model = Documents::model()->findByPk($id);\r\n if ($model === null)\r\n throw new CHttpException(404, 'The requested page does not exist.');\r\n return $model;\r\n }", "public static function findById($id){\n \t$data = self::find($id);\n \tif (!$data) {\n \t\tabort(404);\n \t}\n \treturn $data;\n }", "public static function findById($id){\n \t$data = self::find($id);\n \tif (!$data) {\n \t\tabort(404);\n \t}\n \treturn $data;\n }", "public static function findById($id){\n \t$data = self::find($id);\n \tif (!$data) {\n \t\tabort(404);\n \t}\n \treturn $data;\n }", "public function find($id)\n {\n $wpdb = $this->__connect();\n $sql = $wpdb->prepare(\"SELECT * FROM \" . $this->get_table() . \" WHERE id = %d\", $id);\n $record = $wpdb->get_row($sql, ARRAY_A);\n if ($record) {\n $model = $this->fetch_model($record);\n return $model;\n }\n\n return null;\n }", "protected function findModel($id)\n\t{\n\t\tif (($model = TicketComment::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new HttpException(404, 'The requested page does not exist.');\n\t\t}\n\t}", "public function loadModel($id)\n\t{\n\t\t$model=Entity::model()->with('people')->findByPk($id);\n\t\tif($model===null)\n\t\t\tthrow new CHttpException(404,'The requested page does not exist.');\n\t\treturn $model;\n\t}", "public function loadModel($id)\n\t{\n\t\t$model=MailSms::model()->findByPk($id);\n\t\tif($model===null)\n\t\t\tthrow new CHttpException(404,'The requested page does not exist.');\n\t\treturn $model;\n\t}" ]
[ "0.6898821", "0.66718674", "0.6242269", "0.6207201", "0.61925197", "0.6069365", "0.60247093", "0.5997926", "0.59619695", "0.5934585", "0.59209913", "0.5847453", "0.58265615", "0.58198285", "0.5804145", "0.5803859", "0.5793136", "0.5773433", "0.5768629", "0.5766998", "0.5761342", "0.5747274", "0.5732804", "0.57325625", "0.57325625", "0.57325625", "0.57316643", "0.5729504", "0.57260865", "0.5707215" ]
0.6699304
1
Gets user spam rules that match the specified criteria.
public function getUserSpamRules(array $conditions = array(), array $fetchOptions = array()) { $whereClause = $this->prepareUserSpamRuleConditions($conditions, $fetchOptions); $sqlClauses = $this->prepareUserSpamRuleFetchOptions($fetchOptions); $limitOptions = $this->prepareLimitFetchOptions($fetchOptions); return $this->fetchAllKeyed($this->limitQueryResults(' SELECT user_spam_rule.* ' . $sqlClauses['selectFields'] . ' FROM xf_user_spam_rule_waindigo AS user_spam_rule ' . $sqlClauses['joinTables'] . ' WHERE ' . $whereClause . ' ' . $sqlClauses['orderClause'] . ' ', $limitOptions['limit'], $limitOptions['offset'] ), 'user_spam_rule_id'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getUserSpamRule(array $conditions = array(), array $fetchOptions = array())\n {\n $userSpamRules = $this->getUserSpamRules($conditions, $fetchOptions);\n\n return reset($userSpamRules);\n }", "public function getDefaultUserSpamRule()\n {\n return array(\n 'user_spam_rule_id' => '', /* END 'user_spam_rule_id' */\n 'action' => 'moderate', /* END 'action' */\n 'request_criteria' => '', /* END 'request_criteria' */\n );\n }", "public function getRules();", "public function getRules();", "public function getRules();", "public function getDefaultSpamRule()\n {\n return array(\n 'spam_rule_id' => '', /* END 'spam_rule_id' */\n 'action' => 'moderate', /* END 'action' */\n 'user_criteria' => '', /* END 'user_criteria' */\n 'content_criteria' => '', /* END 'content_criteria' */\n 'request_criteria' => '', /* END 'request_criteria' */\n );\n }", "abstract public function getRules();", "public function getCriteria();", "public function getCriteria();", "public function getSpamRule(array $conditions = array(), array $fetchOptions = array())\n {\n $spamRules = $this->getSpamRules($conditions, $fetchOptions);\n\n return reset($spamRules);\n }", "function getRules()\n {\n $list = array();\n foreach ($this->getBots() as $bot) {\n if(is_array($bot)){\n $bot = (object) $bot;\n }\n if ($bot->state) {\n $list[] = 'SetEnvIfNoCase User-Agent \"' . $bot->re . '\" block_bot';\n }\n\n }\n $list[] = \"<Limit GET POST HEAD>\";\n $list[] = \"Order Allow,Deny\";\n $list[] = \"Allow from all\";\n $list[] = \"Deny from env=block_bot\";\n $list[] = \"</Limit>\";\n\n return $list;\n }", "public function rules()\n {\n $user = Auth::user();\n\n if ($user->role == User::CUSTOMER) {\n return $this->customerRules($user);\n }\n\n }", "public function countUserSpamRules(array $conditions = array())\n {\n $fetchOptions = array();\n\n $whereClause = $this->prepareUserSpamRuleConditions($conditions, $fetchOptions);\n $joinOptions = $this->prepareUserSpamRuleFetchOptions($fetchOptions);\n\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->_getDb()->fetchOne('\n SELECT COUNT(*)\n FROM xf_user_spam_rule_waindigo AS user_spam_rule\n ' . $joinOptions['joinTables'] . '\n WHERE ' . $whereClause . '\n ');\n }", "protected function _getValidRules()\n {\n if ($this->_validRules === null) {\n $helper = $this->helper('ambannerslite');\n if (Mage::helper('ambase')->isModuleActive('Amasty_Promo') && !$helper->checkRulesForBanners()) {\n $this->_validRules = $this->_getRules();\n } else if (Mage::helper('ambase')->isModuleActive('Amasty_Rules')\n && !$helper->checkRulesForBannersRules()\n ) {\n $this->_validRules = $this->_getRules();\n } else {\n $this->_validRules = new Varien_Object();\n }\n }\n\n return $this->_validRules;\n }", "protected function genListCriteria(Request $request, User $user)\n {\n $criteria = array(\n 'mobil' => $request->get('mobil'),\n 'name' => $request->get('name'),\n 'store' => $user->getStore()\n );\n\n return array_filter($criteria, array($this, '_isNotNull'));\n }", "function getRules($chapId = null) {\n if (!$chapId) {\n return array();\n }\n $query = $this->select()->where('user_id = ?', $chapId);\n $results = $query->query()->fetchAll();\n if ($results) {\n return $results;\n } else {\n return array();\n }\n }", "public function getSpamRules(array $conditions = array(), array $fetchOptions = array())\n {\n $whereClause = $this->prepareSpamRuleConditions($conditions, $fetchOptions);\n\n $sqlClauses = $this->prepareSpamRuleFetchOptions($fetchOptions);\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->fetchAllKeyed($this->limitQueryResults('\n SELECT spam_rule.*\n ' . $sqlClauses['selectFields'] . '\n FROM xf_spam_rule AS spam_rule\n ' . $sqlClauses['joinTables'] . '\n WHERE ' . $whereClause . '\n ' . $sqlClauses['orderClause'] . '\n ', $limitOptions['limit'], $limitOptions['offset']\n ), 'spam_rule_id');\n }", "protected function _getRules()\n {\n $key = $this->getWebsiteId() . '_' . $this->getCustomerGroupId() . '_' . $this->getCouponCode();\n\n return $this->_rules[$key];\n }", "public function rules()\n {\n $rules = [\n 'title' => ['required', new SpamFree],\n 'body' => ['required', new SpamFree],\n ];\n\n if ($this->method() === 'POST') {\n $rules['channel_id'] = ['required', 'exists:channels,id'];\n $rules['g-recaptcha-response'] = ['required', $this->recaptcha];\n }\n\n return $rules;\n }", "public function rules()\n {\n if(Auth::user()->rol == \"Administrador\" && !$this->has(\"id\"))\n return array_merge(User::rules($this, false), Testimonio::rules($this));\n\n return Testimonio::rules($this);\n }", "public static function getUserSpamRuleTitles()\n {\n $userSpamRules = XenForo_Model::create(__CLASS__)->getUserSpamRules();\n $titles = array();\n foreach ($userSpamRules as $userSpamRuleId => $userSpamRule) {\n $titles[$userSpamRuleId] = $userSpamRule['title'];\n }\n return $titles;\n }", "public function get_rules() {\n $sql = \"SELECT * FROM rules\";\n $result = $this->conn->query($sql);\n $final = array();\n if ($result->num_rows > 0) {\n while ($row = $result->fetch_object()) {\n $final[] = $row;\n }\n }\n return $final;\n }", "function scorecardUserCond() {\n //getting all users under this supervisor \n $accessBranchList = $this->_getAccessBranchListArray();\n $accessDeptList = $this->_getAccessDeptListArray();\n $conditions = array();\n\n //$conditions = array();\n if ($accessBranchList != 'all') {\n $branchCndnt = array('User.branch_id' => $accessBranchList);\n $conditions = array_merge($conditions, $branchCndnt);\n }\n\n //$conditions = array();\n if ($accessDeptList != 'all') {\n $deptsCndnt = array('User.department_id' => $accessDeptList);\n $conditions = array_merge($conditions, $deptsCndnt);\n }\n if ($this->Session->read('filterScorecard') != '') {\n\n if ($this->Session->read('filterScorecard.branch_list') != '') {\n $brachCndnt = array('User.branch_id' => $this->Session->read('filterScorecard.branch_list'));\n $conditions = array_merge($conditions, $brachCndnt);\n } else {\n $this->Session->delete('filterData');\n }\n }\n return $conditions;\n }", "public static function rules()\n\t{\n\t\t$rules = self::autoLoad();\n\t\t\n\t\treturn $rules;\n\t}", "public function accessRules()\n\t{\n\t\t$rules = Functional::model()->getPermmision($this->id);\n return $rules;\n\t}", "public function getRules()\n {\n }", "public function getRules()\n {\n }", "public function wafRules()\n {\n return (new WafRuleClient($this->httpClient))->auth($this->token);\n }", "public function get_user_access_rules( $args = array() ) {\n\t\t\treturn $this->build_request( 'user/firewall/access_rules/rules', $args )->fetch();\n\t\t}", "public function search($criteria) {\n $messages = @imap_search($this->conn, $criteria);\n if (is_array($messages)) {\n return $messages;\n }\n return array();\n }" ]
[ "0.6102222", "0.5785956", "0.5773417", "0.5773417", "0.5773417", "0.5495366", "0.5322527", "0.5282855", "0.5282855", "0.5252317", "0.5249577", "0.5234436", "0.518658", "0.5086412", "0.50791687", "0.50458145", "0.5030107", "0.502238", "0.5014858", "0.49867302", "0.49690798", "0.49677637", "0.4966913", "0.49471945", "0.4937578", "0.49027568", "0.49027568", "0.49000368", "0.48847666", "0.48802915" ]
0.61511946
0
/ END getUserSpamRules Gets the user spam rule that matches the specified criteria.
public function getUserSpamRule(array $conditions = array(), array $fetchOptions = array()) { $userSpamRules = $this->getUserSpamRules($conditions, $fetchOptions); return reset($userSpamRules); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getUserSpamRules(array $conditions = array(), array $fetchOptions = array())\n {\n $whereClause = $this->prepareUserSpamRuleConditions($conditions, $fetchOptions);\n\n $sqlClauses = $this->prepareUserSpamRuleFetchOptions($fetchOptions);\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->fetchAllKeyed($this->limitQueryResults('\n SELECT user_spam_rule.*\n ' . $sqlClauses['selectFields'] . '\n FROM xf_user_spam_rule_waindigo AS user_spam_rule\n ' . $sqlClauses['joinTables'] . '\n WHERE ' . $whereClause . '\n ' . $sqlClauses['orderClause'] . '\n ', $limitOptions['limit'], $limitOptions['offset']\n ), 'user_spam_rule_id');\n }", "public function getUserSpamRuleById($userSpamRuleId, array $fetchOptions = array())\n {\n $conditions = array('user_spam_rule_id' => $userSpamRuleId);\n\n return $this->getUserSpamRule($conditions, $fetchOptions);\n }", "public function getDefaultUserSpamRule()\n {\n return array(\n 'user_spam_rule_id' => '', /* END 'user_spam_rule_id' */\n 'action' => 'moderate', /* END 'action' */\n 'request_criteria' => '', /* END 'request_criteria' */\n );\n }", "public function countUserSpamRules(array $conditions = array())\n {\n $fetchOptions = array();\n\n $whereClause = $this->prepareUserSpamRuleConditions($conditions, $fetchOptions);\n $joinOptions = $this->prepareUserSpamRuleFetchOptions($fetchOptions);\n\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->_getDb()->fetchOne('\n SELECT COUNT(*)\n FROM xf_user_spam_rule_waindigo AS user_spam_rule\n ' . $joinOptions['joinTables'] . '\n WHERE ' . $whereClause . '\n ');\n }", "public function getRules();", "public function getRules();", "public function getRules();", "public function getDefaultSpamRule()\n {\n return array(\n 'spam_rule_id' => '', /* END 'spam_rule_id' */\n 'action' => 'moderate', /* END 'action' */\n 'user_criteria' => '', /* END 'user_criteria' */\n 'content_criteria' => '', /* END 'content_criteria' */\n 'request_criteria' => '', /* END 'request_criteria' */\n );\n }", "public function getSpamRule(array $conditions = array(), array $fetchOptions = array())\n {\n $spamRules = $this->getSpamRules($conditions, $fetchOptions);\n\n return reset($spamRules);\n }", "public static function getUserSpamRuleTitles()\n {\n $userSpamRules = XenForo_Model::create(__CLASS__)->getUserSpamRules();\n $titles = array();\n foreach ($userSpamRules as $userSpamRuleId => $userSpamRule) {\n $titles[$userSpamRuleId] = $userSpamRule['title'];\n }\n return $titles;\n }", "public function get_user_access_rules( $args = array() ) {\n\t\t\treturn $this->build_request( 'user/firewall/access_rules/rules', $args )->fetch();\n\t\t}", "public function rules()\n {\n $user = Auth::user();\n\n if ($user->role == User::CUSTOMER) {\n return $this->customerRules($user);\n }\n\n }", "abstract public function getRules();", "public function rules()\n {\n return User::$rules;\n }", "protected function _getValidRules()\n {\n if ($this->_validRules === null) {\n $helper = $this->helper('ambannerslite');\n if (Mage::helper('ambase')->isModuleActive('Amasty_Promo') && !$helper->checkRulesForBanners()) {\n $this->_validRules = $this->_getRules();\n } else if (Mage::helper('ambase')->isModuleActive('Amasty_Rules')\n && !$helper->checkRulesForBannersRules()\n ) {\n $this->_validRules = $this->_getRules();\n } else {\n $this->_validRules = new Varien_Object();\n }\n }\n\n return $this->_validRules;\n }", "protected function _getRules()\n {\n $key = $this->getWebsiteId() . '_' . $this->getCustomerGroupId() . '_' . $this->getCouponCode();\n\n return $this->_rules[$key];\n }", "function getRules($chapId = null) {\n if (!$chapId) {\n return array();\n }\n $query = $this->select()->where('user_id = ?', $chapId);\n $results = $query->query()->fetchAll();\n if ($results) {\n return $results;\n } else {\n return array();\n }\n }", "public function prepareUserSpamRuleConditions(array $conditions, array &$fetchOptions)\n {\n $db = $this->_getDb();\n $sqlConditions = array();\n\n if (isset($conditions['user_spam_rule_ids']) && !empty($conditions['user_spam_rule_ids'])) {\n $sqlConditions[] = 'user_spam_rule.user_spam_rule_id IN (' . $db->quote($conditions['user_spam_rule_ids']) . ')';\n } else if (isset($conditions['user_spam_rule_id'])) {\n $sqlConditions[] = 'user_spam_rule.user_spam_rule_id = ' . $db->quote($conditions['user_spam_rule_id']);\n }\n\n $this->_prepareUserSpamRuleConditions($conditions, $fetchOptions, $sqlConditions);\n\n return $this->getConditionsForClause($sqlConditions);\n }", "public static function getRules()\n {\n return static::$rules;\n }", "protected function getShowRules()\n\t{\n\t\treturn $this->showRules;\n\t}", "public function getSpam()\n {\n return $this->spam;\n }", "public function getSpamRules(array $conditions = array(), array $fetchOptions = array())\n {\n $whereClause = $this->prepareSpamRuleConditions($conditions, $fetchOptions);\n\n $sqlClauses = $this->prepareSpamRuleFetchOptions($fetchOptions);\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->fetchAllKeyed($this->limitQueryResults('\n SELECT spam_rule.*\n ' . $sqlClauses['selectFields'] . '\n FROM xf_spam_rule AS spam_rule\n ' . $sqlClauses['joinTables'] . '\n WHERE ' . $whereClause . '\n ' . $sqlClauses['orderClause'] . '\n ', $limitOptions['limit'], $limitOptions['offset']\n ), 'spam_rule_id');\n }", "private function addRequiresUserRules(array $rules, User $user): array\n {\n $additionalRules = [];\n\n foreach ($rules as $rule) {\n foreach (self::RULE_REQUIRES_USER_PREFIXES as $modelPrefix) {\n if (starts_with($rule['model'], $modelPrefix)) {\n $additionalRules[] = $this->createRequireUserRule($user, $modelPrefix);\n }\n }\n }\n\n // make sure all those additional rules are unique.\n return array_merge($rules, collect($additionalRules)->unique('model')->all());\n }", "public function accessRules()\r\n\t{\r\n\t return array(\r\n\t array('allow', // allow any action for user with id 1.\r\n\t 'actions'=>array('index','view','create','workflow','update', 'admin','delete'),\r\n\t 'users'=>array('@'),\r\n\t 'expression'=>'$user->id == 1',\r\n\t ),\r\n\t array('allow', // Allow users to report on their goals.\r\n\t 'actions'=>array('report'),\r\n\t 'users'=>array('@'),\r\n\t 'expression'=>'Goal::model()->findByAttributes(array(\"active\"=>1, \"userId\"=>$user->id, \"id\" => (int)Yii::app()->getRequest()->getQuery(\"id\")))',\r\n\t ),\r\n\t array('allow', // Allow authenticated users to create news goals using the workflow.\r\n\t 'actions'=>array('workflow'),\r\n\t 'users'=>array('@'),\n\t 'expression'=>'!Goal::model()->findByAttributes(array(\"active\"=>1, \"userId\"=>$user->id))',\r\n\t ),\r\n\t array('deny', // deny all users\r\n\t 'users'=>array('*'),\r\n\t ),\r\n\t );\r\n\t}", "public function getRules()\n {\n }", "public function getRules()\n {\n }", "public static function getRules ()\n {\n return self::$rules;\n }", "public function accessRules()\n\t{\n\t\t$rules = Functional::model()->getPermmision($this->id);\n return $rules;\n\t}", "public static function getSpamRuleTitles()\n {\n $spamRules = XenForo_Model::create(__CLASS__)->getSpamRules();\n $titles = array();\n foreach ($spamRules as $spamRuleId => $spamRule) {\n $titles[$spamRuleId] = $spamRule['title'];\n }\n return $titles;\n }", "protected function getRulesFor($name)\n\t{\n\t\treturn $this->hasRulesFor($name) ? $this->rules[$name] : '';\n\t}" ]
[ "0.63552374", "0.61070716", "0.6009894", "0.5545289", "0.54433143", "0.54433143", "0.54433143", "0.54159653", "0.5335837", "0.528417", "0.51786256", "0.5168599", "0.51493424", "0.5008134", "0.49561512", "0.49353448", "0.49074483", "0.48268694", "0.4794002", "0.47240114", "0.47095683", "0.47052255", "0.47040927", "0.46951824", "0.46905726", "0.46905726", "0.467548", "0.46621448", "0.46492434", "0.4622131" ]
0.6608033
0
/ END getUserSpamRule Gets a user spam rule by ID.
public function getUserSpamRuleById($userSpamRuleId, array $fetchOptions = array()) { $conditions = array('user_spam_rule_id' => $userSpamRuleId); return $this->getUserSpamRule($conditions, $fetchOptions); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getRule($id) {\r\n\t\treturn $this->rules[$id];\r\n\t}", "public function getRule( $id )\n {\n return $this->rules[$id];\n }", "public function getSpamRuleById($spamRuleId, array $fetchOptions = array())\n {\n $conditions = array('spam_rule_id' => $spamRuleId);\n\n return $this->getSpamRule($conditions, $fetchOptions);\n }", "public function show( $id )\n {\n // Fetch a particular rule, by id, within the users list of rules.\n //\n $rule = $this->ruleRepository->byIdAndUserWithApplications( $id, Auth::user() );\n\n // Return the response.\n //\n return $this->response( $rule );\n }", "public function getUserSpamRule(array $conditions = array(), array $fetchOptions = array())\n {\n $userSpamRules = $this->getUserSpamRules($conditions, $fetchOptions);\n\n return reset($userSpamRules);\n }", "public function getDefaultUserSpamRule()\n {\n return array(\n 'user_spam_rule_id' => '', /* END 'user_spam_rule_id' */\n 'action' => 'moderate', /* END 'action' */\n 'request_criteria' => '', /* END 'request_criteria' */\n );\n }", "function task_get_user_score($task_id, $user_id, $round_id = 'arhiva') {\n // Validate\n if (!is_round_id($round_id)) {\n log_error('Invalid round id');\n }\n if (!is_task_id($task_id)) {\n log_error('Invalid task id');\n }\n if (!is_user_id($user_id)) {\n log_error('Invalid user id');\n }\n\n // Check the cache\n $cache_key = 'user-task-round:'.$user_id.'-'.$task_id.'-'.$round_id;\n if (($res = mem_cache_get($cache_key)) != false) {\n return $res;\n }\n\n // Query database\n $query = sprintf(\n 'SELECT `score` FROM ia_score_user_round_task\n WHERE round_id = %s AND task_id = %s AND user_id = %s',\n db_quote($round_id), db_quote($task_id), db_quote($user_id));\n $res = db_fetch($query);\n $score = getattr($res, 'score', null);\n\n // Keep in cache\n mem_cache_set($cache_key, (int)$score);\n\n return $score;\n}", "public static function readrule($id)\n {\n $res = DB::table('jy_roleprivileges')\n ->join('jy_roles','jy_roleprivileges.rid','=','jy_roles.rid')\n ->join('jy_privileges','jy_roleprivileges.pid','=','jy_privileges.id')\n ->where('jy_roleprivileges.rid',$id)\n ->get();\n return $res;\n }", "public function delete_user_accesss_rule( $id ) {\n\t\t\treturn $this->build_request( \"user/firewall/access_rules/rules/$id\", '', 'DELETE' )->fetch();\n\t\t}", "private function getRule($sid)\n {\n $this->updateSIDlist();\n if (!array_key_exists($sid, $this->sid_list)) {\n $rule = $this->rules->rule->Add();\n $rule->sid = $sid;\n $this->sid_list[$sid] = $rule;\n }\n return $this->sid_list[$sid];\n }", "function helpdesk_get_user($id) {\n if (empty($id)) {\n error(get_string('missingidparam', 'block_helpdesk'));\n }\n return get_record('user', 'id', $id);\n}", "public function getRule($ruleName);", "public static function getRule($scannerId, $ruleId) {\r\n\t\t$db = PearDatabase::getInstance();\r\n\r\n\t\t$result = $db->pquery(\"SELECT * FROM vtiger_mailscanner_rules WHERE scannerid = ? AND ruleid = ?\", array($scannerId, $ruleId));\r\n\t\tif ($db->num_rows($result)) {\r\n\t\t\t$rowData = $db->query_result_rowdata($result);\r\n\t\t\t$ruleModel = new self();\r\n\t\t\t$ruleModel->setData($rowData);\r\n\t\t\t$action = reset($ruleModel->getActions());\r\n\t\t\t return $ruleModel->set('action', str_replace(',', '_', $action->actiontext));\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public function getRuleId()\n {\n return $this->ruleId;\n }", "protected function findModel($id)\r\n {\r\n $item = Yii::$app->authManager->getRule($id);\r\n if ($item) {\r\n return new BizRule($item);\r\n } else {\r\n //log error\r\n return false;\r\n }\r\n }", "public function findByUserId($id)\n {\n return $this->model->where('user_id', $id)->first();\n }", "function get_user_by_id($id) {\n\tglobal $wpdb;\n\tglobal $webgrain;\n\t$sql = \"SELECT * FROM \" . $webgrain->usertable . \" WHERE id = $id\";\n\t$result = $wpdb->get_results($wpdb->prepare($sql, 0));\n\tif(!empty($result)) { foreach($result as $r) { return $r; } }\n}", "function get_user($id) {\r\n\t\t\tglobal $wpdb;\r\n\t\t\t\r\n\t\t\t$users_table = $this->model->get_users_table_name();\r\n\t\t\t\r\n\t\t\t$users = $wpdb->get_results(\"SELECT * FROM $users_table WHERE tractis_auth_userid = '$id'\");\r\n\t\t\tif (count($users)>0){\r\n\t\t\t\treturn $users[0];\r\n\t\t\t}else{\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}", "public function findScoreMember($id)\n {\n $resultat = $this->db->query(\"SELECT u.id, st.id, st.date, st.score, st.id_user FROM users u INNER JOIN scoreTable st ON u.id = st.id_user WHERE u.id=$id\");\n return $resultat->fetchAll(PDO::FETCH_ASSOC);\n }", "public function getUserID($id){\n\t\t$tmp = StaffDB::find($id);\n\t\tif($tmp!=NULL){\n\t\t\treturn $tmp->userID;\n\t\t}\n\t\telse {\n\t\t\treturn NULL;\n\t\t}\t\t\n\t}", "public function getFunctionForRule ( $rule ) {\n\n return $this->_rules[$rule];\n }", "function get_user_by_id($id) {\r\n\t\t\tglobal $wpdb;\r\n\r\n\t\t\t$users_table = $this->model->get_users_table_name();\r\n\t\t\t$usermeta_table = $this->model->get_usermeta_table_name();\r\n\t\t\t\r\n\t\t\t$users = $wpdb->get_results(\"SELECT * FROM $users_table WHERE ID = $id\");\r\n\t\t\t\r\n\t\t\tif (count($users)>0){\r\n\t\t\t\t$issuer = get_usermeta($id,'tractis_auth_issuer');\r\n\t\t\t\t$verification_url = get_usermeta($id,'verification_url');\r\n\t\t\t\treturn array(\r\n\t\t\t\t\t'user' => $users[0], \r\n\t\t\t\t\t'issuer' => $issuer,\r\n\t\t\t\t\t'verification_url' => $verification_url,\r\n\t\t\t\t);\r\n\t\t\t}else{\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}", "public function getId() {\r\n\t\treturn $this->get('ruleid');\r\n\t}", "function getRules($chapId = null) {\n if (!$chapId) {\n return array();\n }\n $query = $this->select()->where('user_id = ?', $chapId);\n $results = $query->query()->fetchAll();\n if ($results) {\n return $results;\n } else {\n return array();\n }\n }", "function getuser($id) {\n\tglobal $users;\n\t\n\tforeach ($users as $user => $data)\n\t\tif ((is_string($id) && (strtolower($user) == strtolower($id))) ||\n\t\t\t\t(is_integer($id) && ($data['uid'] == $id)))\n\t\t\treturn $user;\n\t\n\treturn false;\n}", "public function findUser($id) {\n return static::find($id);\n }", "public function getReferralByID($id) {\n\t\t$sql = \"SELECT reff from reff where id='\".(int)$id.\"' LIMIT 1\";\n\t\t$result = parent::get('db')->mysqli()->query($sql);\n\t\tif($result) {\n\t\t\treturn parent::get('db')->fetchArray($result);\n\t\t}\n\t\treturn false;\n\t}", "public function show($id)\n {\n return User::where('user_telegram_id', $id)->first();\n }", "function get_user_by_id( $id ) {\n\t$output = false;\n\t$findings = 0;\n\t$user_found = array();\n\n\tforeach ( get_user_data() as $user => $attrs ) {\n\t\tif ( $attrs['id'] == $id ) {\n\t\t\t$findings = $findings + 1;\n\t\t\tarray_push( $user_found , $attrs );\n\t\t}\n\t}\n\tif ( $findings === 1 ) {\n\t\t$output = $user_found[0];\n\t\tunset( $user_found );\n\t} else {\n\t\tunset( $user_found );\n\t}\n\treturn $output;\n}", "public function getRule($name);" ]
[ "0.63710433", "0.6319009", "0.58140826", "0.53317004", "0.52431023", "0.5202751", "0.52025527", "0.5143501", "0.5092426", "0.50655055", "0.5047531", "0.5039779", "0.5036372", "0.5023568", "0.4916178", "0.49027", "0.48390034", "0.48371986", "0.483227", "0.48280597", "0.48157156", "0.47976542", "0.4796635", "0.4794631", "0.4792484", "0.47652346", "0.47609764", "0.47483584", "0.47455984", "0.4738987" ]
0.7124399
0
/ END prepareUserSpamRules Gets the total number of a user spam rule that match the specified criteria.
public function countUserSpamRules(array $conditions = array()) { $fetchOptions = array(); $whereClause = $this->prepareUserSpamRuleConditions($conditions, $fetchOptions); $joinOptions = $this->prepareUserSpamRuleFetchOptions($fetchOptions); $limitOptions = $this->prepareLimitFetchOptions($fetchOptions); return $this->_getDb()->fetchOne(' SELECT COUNT(*) FROM xf_user_spam_rule_waindigo AS user_spam_rule ' . $joinOptions['joinTables'] . ' WHERE ' . $whereClause . ' '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function countSpamRules(array $conditions = array())\n {\n $fetchOptions = array();\n\n $whereClause = $this->prepareSpamRuleConditions($conditions, $fetchOptions);\n $joinOptions = $this->prepareSpamRuleFetchOptions($fetchOptions);\n\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->_getDb()->fetchOne('\n SELECT COUNT(*)\n FROM xf_spam_rule AS spam_rule\n ' . $joinOptions['joinTables'] . '\n WHERE ' . $whereClause . '\n ');\n }", "public function getSpamCount() {\n return $this->_totals['spam'];\n }", "public function getSpamCount()\n {\n return $this->count(self::SPAM);\n }", "public function findUserCount();", "function ExtendedNumSpam() {\n\t\treturn DB::query(\"SELECT COUNT(*) FROM \\\"PageComment\\\" \" . \n\t\t\tself::SubsiteJoin() . \" WHERE \" . self::SubsiteWhere() . \n\t\t\t\"\\\"IsSpam\\\"=1\")->value();\n\t}", "public function getTotalContactCount() //for all assigned quires\n\t\t{\n\t\t\t\n\t\t\t\t$this->load->model('admin/Users_model', 'users');\n\t\t\t\t$data['queryCount'] = $this->users->getContactTotalCount();\n\t\t\t\techo $data['queryCount'];\n\t\t\t\n\t\t}", "public function get_total_items_user(){\n $count = $this->fetch(\"SELECT id FROM posts WHERE user = $this->user\");\n return $count ? count($count) : 0;\n }", "private function getTotalUsers($user)\n {\n if (Auth::check() && $user->hasRole('admin')) {\n return count($this->getAllUsers());\n }\n }", "function get_numusers() {\n global $CFG;\n\n $countsql = \"SELECT COUNT(DISTINCT u.id)\n FROM {$CFG->prefix}grade_grades g RIGHT OUTER JOIN\n {$CFG->prefix}user u ON (u.id = g.userid AND g.itemid = $this->sortitemid)\n LEFT JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid\n $this->groupsql\n WHERE ra.roleid in ($this->gradebookroles)\n $this->groupwheresql\n AND ra.contextid \".get_related_contexts_string($this->context);\n return count_records_sql($countsql);\n }", "function getUserCount($filter=array()) {\n\n if($this->users === null) $this->_loadUserData();\n\n if (!count($filter)) return count($this->users);\n\n $count = 0;\n $this->_constructPattern($filter);\n\n foreach ($this->users as $user => $info) {\n $count += $this->_filter($user, $info);\n }\n\n return $count;\n }", "function bbp_get_total_users()\n{\n}", "public function getTotalqueryCount() //for all assigned quires\n\t\t{\n\t\t\t\n\t\t\t\t$this->load->model('admin/Users_model', 'users');\n\t\t\t\t$data['queryCount'] = $this->users->getQueryTotalCount();\n\t\t\t\techo $data['queryCount'];\n\t\t\t\n\t\t}", "public function countCourseUsersAggregatingResults($constraints = array()) {\n !empty($constraints) OR $constraints = array('archive' => false, 'active' => true);\n list($where, $limit, $orderby) = EfrontUser :: convertUserConstraintsToSqlParameters($constraints);\n $from = \"(users u, (select uc.score,uc.completed,uc.users_LOGIN,uc.to_timestamp, uc.from_timestamp as active_in_course from courses c left outer join users_to_courses uc on uc.courses_ID=c.id where (c.id=\".$this -> course['id'].\" or c.instance_source=\".$this -> course['id'].\") and uc.archive=0) r)\";\n $from = EfrontCourse :: appendTableFiltersUserConstraints($from, $constraints);\n $where[] = \"u.login=r.users_LOGIN\";\n $select = \"u.login\";\n $groupby = \"r.users_LOGIN\";\n $result = eF_countTableData($from, $select, implode(\" and \", $where), false, $groupby);\n return $result[0]['count'];\n }", "public function count()\n {\n if ($this->queryShouldBeStopped) {\n return 0;\n }\n\n $queryType = 'UserQuery::count';\n $filter = $this->normalizeFilter();\n $callback = function() use ($filter) {\n return (int) $this->bxObject->getList($order = 'ID', $by = 'ASC', $filter, [\n 'NAV_PARAMS' => [\n 'nTopCount' => 0,\n ],\n ])->NavRecordCount;\n };\n\n return $this->handleCacheIfNeeded(compact('queryType', 'filter'), $callback);\n }", "public function getRejectedContactCount() //for all assigned quires\n\t\t{\n\t\t\t\n\t\t\t\t$this->load->model('admin/Users_model', 'users');\n\t\t\t\t$data['queryCount'] = $this->users->getContactRejectedCount();\n\t\t\t\techo $data['queryCount'];\n\t\t\t\n\t\t}", "public static function countAll()\n {\n $query = 'SELECT COUNT(*) as total FROM ' . rex::getTablePrefix() . \"375_user WHERE email != ''\";\n $result = rex_sql::factory();\n $result->setQuery($query);\n\n return $result->getValue('total');\n }", "function wp_count_users( $args = '' ) {\n\twp_parse_args(\n\t\t$args, array(\n\t\t\t'role' => ''\n\t\t)\n\t);\n\t\n\t$users = new WP_Query_Users( $args );\n\treturn $users->get_total();\n\t\n}", "public function countCourseUsers($constraints = array()) {\n !empty($constraints) OR $constraints = array('archive' => false, 'active' => true);\n list($where, $limit, $orderby) = EfrontUser :: convertUserConstraintsToSqlParameters($constraints);\n //$select = \"u.*, uc.courses_ID,uc.completed,uc.score,uc.user_type,uc.from_timestamp as active_in_course, 1 as has_course\";\n $where[] = \"u.login=uc.users_LOGIN and uc.courses_ID='\".$this -> course['id'].\"' and uc.archive=0\";\n $result = eF_countTableData(\"users u, users_to_courses uc\", \"u.login\", implode(\" and \", $where));\n return $result[0]['count'];\n }", "public function total_user_count() {\n $this->db->where(array('status' => 1));\n $users_count = $this->db->from('users')->count_all_results();\n\n return $users_count;\n }", "function total_friend_count( $user_id = false ) {\r\n\t\tglobal $wpdb, $bp;\r\n\t\tif ( !$user_id )\r\n\t\t\t$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;\r\n\t\t/* This is stored in 'total_friend_count' usermeta.\r\n\t\t This function will recalculate, update and return. */\r\n\t\t$count = $wpdb->get_var( $wpdb->prepare( \"SELECT COUNT(id) FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1\", $user_id, $user_id ) );\r\n\t\tif ( !$count )\r\n\t\t\treturn 0;\r\n\t\tupdate_usermeta( $user_id, 'total_friend_count', $count );\r\n\t\treturn $count;\r\n\t}", "public function countTotal(array $filters)\n {\n $userId = $filters['userId'];\n\n $qb = $this->graphManager->createQueryBuilder();\n\n $qb->match('(user:User{qnoow_id:{userId}})')\n ->with('user')\n ->setParameter('userId', $userId);\n\n $qb->match('(proposal:Proposal)')\n ->where('NOT ((user)-[:PROPOSES]->(proposal))')\n ->with('proposal');\n\n $qb->returns('count(proposal) AS amount');\n\n $resultSet = $qb->getQuery()->getResultSet();\n\n $amount = $resultSet->current()->offsetGet('amount');\n\n return $amount;\n }", "function user_count()\n {\n $this->company_db->from('tbl_user');\n return $this->company_db->count_all_results();\n }", "public function userCount()\n {\n return $this->count();\n }", "public function getAssignedContactCount() //for all assigned quires\n\t\t{\n\t\t\t\n\t\t\t\t$this->load->model('admin/Users_model', 'users');\n\t\t\t\t$data['queryCount'] = $this->users->getContactAssignedCount();\n\t\t\t\techo $data['queryCount'];\n\t\t\t\n\t\t}", "public function totalCount();", "function get_number_of_users() {\n\t$counter = 0;\n\tif (!empty($_SESSION[\"id_session\"])){\n\t\t$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], $_SESSION['id_session']);\n\n\t} else {\n\t\t$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], 0);\n\t}\n\tforeach ($a_course_users as $user_id => $o_course_user) {\n\t\tif ((isset($_GET['keyword']) && search_keyword($o_course_user['firstname'], $o_course_user['lastname'], $o_course_user['username'], $o_course_user['official_code'], $_GET['keyword'])) || !isset($_GET['keyword']) || empty($_GET['keyword'])) {\n\t\t\t$counter++;\n\t\t}\n\t}\n\treturn $counter;\n}", "private function getRecieptsCount($buiness_id, $user_id)\n {\n return Receipt::whereUserIdAndBusinessId($user_id, $buiness_id)->count();\n }", "public function count(array $criteria);", "public function getCount(UserFilter $filter): int;", "public function getTotalUsers() {\n\n\t\treturn $this->distinct()->count('user_id');\n\t}" ]
[ "0.59827155", "0.5846171", "0.5816026", "0.57544434", "0.5603505", "0.55782396", "0.54513156", "0.5445707", "0.53969985", "0.53690535", "0.53662664", "0.53363365", "0.5307656", "0.5302843", "0.529403", "0.52818507", "0.52782184", "0.52778685", "0.52751416", "0.52526397", "0.52508134", "0.524881", "0.52346903", "0.52341366", "0.52293926", "0.5223107", "0.52220386", "0.52197826", "0.5213424", "0.5212632" ]
0.71543574
0
/ END countUserSpamRules Gets all user spam rules titles.
public static function getUserSpamRuleTitles() { $userSpamRules = XenForo_Model::create(__CLASS__)->getUserSpamRules(); $titles = array(); foreach ($userSpamRules as $userSpamRuleId => $userSpamRule) { $titles[$userSpamRuleId] = $userSpamRule['title']; } return $titles; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function countUserSpamRules(array $conditions = array())\n {\n $fetchOptions = array();\n\n $whereClause = $this->prepareUserSpamRuleConditions($conditions, $fetchOptions);\n $joinOptions = $this->prepareUserSpamRuleFetchOptions($fetchOptions);\n\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->_getDb()->fetchOne('\n SELECT COUNT(*)\n FROM xf_user_spam_rule_waindigo AS user_spam_rule\n ' . $joinOptions['joinTables'] . '\n WHERE ' . $whereClause . '\n ');\n }", "public static function getSpamRuleTitles()\n {\n $spamRules = XenForo_Model::create(__CLASS__)->getSpamRules();\n $titles = array();\n foreach ($spamRules as $spamRuleId => $spamRule) {\n $titles[$spamRuleId] = $spamRule['title'];\n }\n return $titles;\n }", "public function getSpamCount()\n {\n return $this->count(self::SPAM);\n }", "public function getSpamCount() {\n return $this->_totals['spam'];\n }", "function ExtendedNumSpam() {\n\t\treturn DB::query(\"SELECT COUNT(*) FROM \\\"PageComment\\\" \" . \n\t\t\tself::SubsiteJoin() . \" WHERE \" . self::SubsiteWhere() . \n\t\t\t\"\\\"IsSpam\\\"=1\")->value();\n\t}", "public function countSpamRules(array $conditions = array())\n {\n $fetchOptions = array();\n\n $whereClause = $this->prepareSpamRuleConditions($conditions, $fetchOptions);\n $joinOptions = $this->prepareSpamRuleFetchOptions($fetchOptions);\n\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->_getDb()->fetchOne('\n SELECT COUNT(*)\n FROM xf_spam_rule AS spam_rule\n ' . $joinOptions['joinTables'] . '\n WHERE ' . $whereClause . '\n ');\n }", "public function getDefaultUserSpamRule()\n {\n return array(\n 'user_spam_rule_id' => '', /* END 'user_spam_rule_id' */\n 'action' => 'moderate', /* END 'action' */\n 'request_criteria' => '', /* END 'request_criteria' */\n );\n }", "protected function get_users()\n\t{\n\t\t$sql = 'SELECT user_style, COUNT(user_style) AS style_count\n\t\t\tFROM ' . USERS_TABLE . '\n\t\t\tGROUP BY user_style';\n\t\t$result = $this->db->sql_query($sql);\n\n\t\t$style_count = array();\n\t\twhile ($row = $this->db->sql_fetchrow($result))\n\t\t{\n\t\t\t$style_count[$row['user_style']] = $row['style_count'];\n\t\t}\n\t\t$this->db->sql_freeresult($result);\n\n\t\treturn $style_count;\n\t}", "public static function getTabRuleTitles()\n {\n $tabRules = XenForo_Model::create(__CLASS__)->getTabRules();\n $titles = array();\n foreach ($tabRules as $tabRuleId => $tabRule) {\n $titles[$tabRuleId] = $tabRule['title'];\n }\n return $titles;\n }", "public function getRejectedContactCount() //for all assigned quires\n\t\t{\n\t\t\t\n\t\t\t\t$this->load->model('admin/Users_model', 'users');\n\t\t\t\t$data['queryCount'] = $this->users->getContactRejectedCount();\n\t\t\t\techo $data['queryCount'];\n\t\t\t\n\t\t}", "public function getUserSpamRules(array $conditions = array(), array $fetchOptions = array())\n {\n $whereClause = $this->prepareUserSpamRuleConditions($conditions, $fetchOptions);\n\n $sqlClauses = $this->prepareUserSpamRuleFetchOptions($fetchOptions);\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->fetchAllKeyed($this->limitQueryResults('\n SELECT user_spam_rule.*\n ' . $sqlClauses['selectFields'] . '\n FROM xf_user_spam_rule_waindigo AS user_spam_rule\n ' . $sqlClauses['joinTables'] . '\n WHERE ' . $whereClause . '\n ' . $sqlClauses['orderClause'] . '\n ', $limitOptions['limit'], $limitOptions['offset']\n ), 'user_spam_rule_id');\n }", "function user_count() {\n\treturn count(user_array());\n}", "function bbp_admin_repair_user_topic_count()\n{\n}", "public static function get_user_contacts_count($userobject = null) {\n global $USER, $DB, $CFG;\n if (!$userobject) {\n $userobject = $USER;\n }\n\n $userblogcount = count($DB->get_records('message_contacts', array('userid' => $userobject->id)));\n\n return $userblogcount;\n }", "public static function get_user_contacts_count($userobject = null)\n {\n global $USER, $DB, $CFG;\n if (!$userobject) {\n $userobject = $USER;\n }\n\n $userblogcount = count($DB->get_records('message_contacts', array('userid'=>$userobject->id)));\n\n return $userblogcount;\n }", "function wp_update_network_user_counts() {\n\tglobal $wpdb;\n\n\t$count = $wpdb->get_var( \"SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'\" );\n\tupdate_site_option( 'user_count', $count );\n}", "public function findUserCount();", "public function countByUser()\n {\n // SELECT user_id, COUNT(*) AS Cnt FROM cquestions GROUP BY user_id ORDER BY user_id ASC;\n $this->db->select(\"user_id, COUNT(*) AS Cnt\")\n ->from($this->getSource())\n ->groupby(\"user_id\")\n ->orderby('user_id ASC')\n ->execute();\n $this->db->execute();\n $this->db->setFetchModeClass(__CLASS__);\n return $this->db->fetchAll();\n }", "public function messagesCount();", "function user_count()\n {\n $this->company_db->from('tbl_user');\n return $this->company_db->count_all_results();\n }", "public static function countAll()\n {\n $query = 'SELECT COUNT(*) as total FROM ' . rex::getTablePrefix() . \"375_user WHERE email != ''\";\n $result = rex_sql::factory();\n $result->setQuery($query);\n\n return $result->getValue('total');\n }", "function checkUserCountRights() {\n\t\tif ($_SESSION['role'] != 1) {\n\t\t\t$process_id = $_SESSION['process_id'];\n\t\t\t$user_id = $_SESSION['user_id'];\n\t\t\t$this -> db -> select('g.campaign_name');\n\t\t\t$this -> db -> from('tbl_campaign g');\n\t\t\t$this -> db -> join('tbl_user_group u', 'u.group_id=g.group_id');\n\t\t\t$this -> db -> where('u.user_id', $user_id);\n\t\t\t$query1 = $this -> db -> get() -> result();\n\t\t\t$c = count($query1);\n\t\t\tif (count($query1) > 0) {\n\t\t\t\t$t = ' ( ';\n\t\t\t\tfor ($i = 0; $i < $c; $i++) {\n\t\t\t\t\tif ($i == 0) {\n\n\t\t\t\t\t\t$t = $t . \"enquiry_for = '\" . $query1[$i] -> campaign_name . \"'\";\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$t = $t . \" or enquiry_for ='\" . $query1[$i] -> campaign_name . \"'\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$st = $t . ')';\n\n\t\t\t}\n\t\t\treturn $st;\n\t\t}\n\n\t}", "public function getRejectedqueryCount() //for all assigned quires\n\t\t{\n\t\t\t\n\t\t\t\t$this->load->model('admin/Users_model', 'users');\n\t\t\t\t$data['queryCount'] = $this->users->getQueryRejectedCount();\n\t\t\t\techo $data['queryCount'];\n\t\t\t\n\t\t}", "function get_all_remessa_count()\n\t{\n\t\t$this->db->from('remessa');\n\t\treturn $this->db->count_all_results();\n\t}", "public static function countUsersAlphabetically($pUserId) {\n $lUser = UserTable::getInstance()->find($pUserId);\n $lFriendIds = $lUser->getIdsOfFriends();\n if(empty($lFriendIds)) {\n return 0;\n }\n $lQuery = self::getUsersAlphabeticallyFilterQuery($lFriendIds);\n return $lQuery->count();\n }", "public function getAncientsMsgCount()\r\n {\r\n return $this->count(self::_ANCIENTS_MSG);\r\n }", "public function userCount()\n {\n return $this->count();\n }", "public function getTotalContactCount() //for all assigned quires\n\t\t{\n\t\t\t\n\t\t\t\t$this->load->model('admin/Users_model', 'users');\n\t\t\t\t$data['queryCount'] = $this->users->getContactTotalCount();\n\t\t\t\techo $data['queryCount'];\n\t\t\t\n\t\t}", "function countusers() {\n\tglobal $users;\n\t\n\treturn count(array_filter($users, '_countusers_callback'));\n}", "public function getAssignedContactCount() //for all assigned quires\n\t\t{\n\t\t\t\n\t\t\t\t$this->load->model('admin/Users_model', 'users');\n\t\t\t\t$data['queryCount'] = $this->users->getContactAssignedCount();\n\t\t\t\techo $data['queryCount'];\n\t\t\t\n\t\t}" ]
[ "0.67208993", "0.63376373", "0.58132845", "0.5668041", "0.56230885", "0.5588674", "0.5174482", "0.5174032", "0.51301956", "0.5030382", "0.49720654", "0.49655113", "0.49630082", "0.49567112", "0.49542373", "0.49506775", "0.49382946", "0.4928744", "0.48776987", "0.48461518", "0.4821893", "0.4781267", "0.47715697", "0.4750545", "0.4748708", "0.4735166", "0.47337174", "0.47204506", "0.47141123", "0.47069588" ]
0.6852091
0
/ END getUserSpamRuleTitles Gets the default user spam rule record.
public function getDefaultUserSpamRule() { return array( 'user_spam_rule_id' => '', /* END 'user_spam_rule_id' */ 'action' => 'moderate', /* END 'action' */ 'request_criteria' => '', /* END 'request_criteria' */ ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getUserSpamRuleTitles()\n {\n $userSpamRules = XenForo_Model::create(__CLASS__)->getUserSpamRules();\n $titles = array();\n foreach ($userSpamRules as $userSpamRuleId => $userSpamRule) {\n $titles[$userSpamRuleId] = $userSpamRule['title'];\n }\n return $titles;\n }", "public function getDefaultSpamRule()\n {\n return array(\n 'spam_rule_id' => '', /* END 'spam_rule_id' */\n 'action' => 'moderate', /* END 'action' */\n 'user_criteria' => '', /* END 'user_criteria' */\n 'content_criteria' => '', /* END 'content_criteria' */\n 'request_criteria' => '', /* END 'request_criteria' */\n );\n }", "public static function getSpamRuleTitles()\n {\n $spamRules = XenForo_Model::create(__CLASS__)->getSpamRules();\n $titles = array();\n foreach ($spamRules as $spamRuleId => $spamRule) {\n $titles[$spamRuleId] = $spamRule['title'];\n }\n return $titles;\n }", "function getDefaultTitle()\n {\n return BlubberExternalContact::find($this->user_id)->name;\n }", "public function getDefaultTitle($force = true) {\n\t\t$fields = $this->getMemberFields();\n\t\t$field = $fields->dataFieldByName($this->MemberField);\n\t\t$title = $field->Title();\n\n\t\tif (!$title && $force) {\n\t\t\t$title = $field->getName();\n\t\t}\n\n\t\treturn $title;\n\t}", "public function getUserSpamRule(array $conditions = array(), array $fetchOptions = array())\n {\n $userSpamRules = $this->getUserSpamRules($conditions, $fetchOptions);\n\n return reset($userSpamRules);\n }", "private function getUserTitle() {\r\n\r\n\t\t$user = $this->params['user'];\r\n\t\tif (is_null($user))\r\n\t\t\t$this->dieUsage(\"User parameter may not be empty\", 'param_user');\r\n\r\n\t\t$userTitle = Title::makeTitleSafe( NS_USER, $user );\r\n\t\tif ( is_null( $userTitle ) )\r\n\t\t\t$this->dieUsage(\"User name $user is not valid\", 'param_user');\r\n\r\n\t\t$userid = $this->getDB()->selectField('user', 'user_id', array (\r\n\t\t\t'user_name' => $userTitle->getText()\r\n\t\t));\r\n\t\t\r\n\t\tif (!$userid)\r\n\t\t\t$this->dieUsage(\"User name $user not found\", 'param_user');\r\n\t\t\t\r\n\t\t$this->userTitle = $userTitle;\r\n\t}", "public function findAllWithDefault() {\n\t\t$allTitles = $this->findAll();\n\n\t\t$arrAllTitles = array();\n\t\t$arrAllTitles[0] = 'Please select ...';\n\t\tforeach ($allTitles as $title) {\n\t\t\t$titleIdentifier = $this->persistenceManager->getIdentifierByObject($title);\n\t\t\t$arrAllTitles[$titleIdentifier] = $title->getName();\n\t\t}\n\n\t\treturn $arrAllTitles;\n\t}", "public function getDefaultTitle()\n {\n return $this->title;\n }", "public function getDefaultTabRule()\n {\n return array(\n 'tab_rule_id' => '', /* END 'tab_rule_id' */\n 'match_content_type' => 'thread', /* END 'match_content_type' */\n 'match_criteria' => '', /* END 'match_criteria' */\n 'create_content_type' => 'thread', /* END 'create_content_type' */\n 'create_criteria' => '', /* END 'create_criteria' */\n );\n }", "public function getTitles($username);", "function be_genesis_default_user_archive_title( $title, $user_id ) {\n\n\tif( empty( $title ) ) \n\t\t$title = get_the_author_meta( 'display_name', $user_id );\n\t\t\n\treturn $title;\n}", "private function getDefaultRecords()\n {\n return array_merge([\n 'action' => json_encode($this->action()),\n 'subject' => $this->getLang('subject'),\n 'intro_line' => $this->getLang('intro_line'),\n 'outro_line' => $this->getLang('outro_line'),\n 'message' => $this->getLang('message'),\n ], $this->default);\n }", "public function getUserSpamRules(array $conditions = array(), array $fetchOptions = array())\n {\n $whereClause = $this->prepareUserSpamRuleConditions($conditions, $fetchOptions);\n\n $sqlClauses = $this->prepareUserSpamRuleFetchOptions($fetchOptions);\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->fetchAllKeyed($this->limitQueryResults('\n SELECT user_spam_rule.*\n ' . $sqlClauses['selectFields'] . '\n FROM xf_user_spam_rule_waindigo AS user_spam_rule\n ' . $sqlClauses['joinTables'] . '\n WHERE ' . $whereClause . '\n ' . $sqlClauses['orderClause'] . '\n ', $limitOptions['limit'], $limitOptions['offset']\n ), 'user_spam_rule_id');\n }", "public function getTitle() {\n foreach ($this->getContents() as $content) {\n $contentAssoc = $content->getAssocArray(false);\n if ($contentAssoc['format'] == \"default\")\n return $contentAssoc['title'];\n }\n }", "public function getDefaultFallbackValue(Collection $values)\n {\n return $this->defaultTitle;\n }", "public function get_default_subject() {\n\t\treturn $this->subject;\n\t}", "public static function getTabRuleTitles()\n {\n $tabRules = XenForo_Model::create(__CLASS__)->getTabRules();\n $titles = array();\n foreach ($tabRules as $tabRuleId => $tabRule) {\n $titles[$tabRuleId] = $tabRule['title'];\n }\n return $titles;\n }", "public function getUserTitle() {\n\t\tif ($this->userTitle) return $this->userTitle;\n\t\tif ($this->getRank()) return WCF::getLanguage()->get($this->getRank()->rankTitle);\n\t\t\n\t\treturn '';\n\t}", "function GetDefaultDetails()\n\t{\t$sql = \"SELECT * FROM news_lang WHERE newsid=$this->id AND lang='{$this->def_lang}'\";\n\t\tif ($result = $this->db->Query($sql))\n\t\t{\tif ($row = $this->db->FetchArray($result))\n\t\t\t{\treturn $row;\n\t\t\t}\n\t\t}\n\t\treturn array();\n\t}", "public function getSpam()\n {\n return $this->spam;\n }", "public static function getAllAssessmentTitle()\n\t\t{\n\t\t\ttry \n\t\t\t{\n\t\t\t\t$data = DB::table('asmt_title')->orderBy('title_name', 'asc')->get();\n\t\t\t\treturn $data;\t\n\t\t\t} \n\t\t\tcatch (Exception $e) \n\t\t\t{\n\t\t\t\tAjaxController::SystemLogs($e->getMessage());\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}", "function getTitle(){\n $user = $this->loadUser(Yii::app()->user->id);\n return $user->title;\n \n}", "public function getAliasTitle();", "function getPostTitlesFromDatabase() {\n // get this data from database instead of hardcoding it\n $postTitles = array(\"Blog Post 1\", \"Blog Post 2\", \"Blog Post 3\");\n return $postTitles;\n }", "protected static function getDefaultUser()\n {\n $name = __METHOD__;\n if ( isset( $GLOBALS[$name] ) )\n {\n return $GLOBALS[$name];\n }\n\n $ini = eZINI::instance( 'cmis.ini' );\n\n $GLOBALS[$name] = $ini->hasVariable( 'CMISSettings', 'DefaultUser' ) ? $ini->variable( 'CMISSettings', 'DefaultUser' ) : '';\n\n return $GLOBALS[$name];\n }", "public function change_default_title( $title ){\n\t\t $screen = get_current_screen();\n\t\t \n\t\t if ( 'popups' == $screen->post_type ) {\n\t\t\t $title = 'Enter Ad Title Here';\n\t\t }\n\t \n\t\t return $title;\n\t}", "public function getDefaultOGTitle()\n {\n if ($this->owner->MetaTitle) {\n $title = trim($this->owner->MetaTitle);\n if (!empty($title)) {\n return $title;\n }\n }\n return $this->owner->getTitle();\n }", "public function defaultRules()\n {\n return is_string($this->defaultRules) ? explode('|', $this->defaultRules) : $this->defaultRules;\n }", "public function post_title( $defaults ) {\r\n\r\n\t\t\t$title = get_post_meta( get_the_ID(), 'site-post-title', true );\r\n\t\t\tif ( 'disabled' == $title ) {\r\n\t\t\t\t$defaults = false;\r\n\t\t\t}\r\n\r\n\t\t\treturn $defaults;\r\n\t\t}" ]
[ "0.67280257", "0.67217255", "0.615632", "0.5894902", "0.5399464", "0.52486396", "0.5177385", "0.5043209", "0.49619022", "0.491225", "0.49100727", "0.48831728", "0.48275766", "0.48268744", "0.47742593", "0.47661677", "0.47647014", "0.4754896", "0.4744628", "0.46795496", "0.46222588", "0.46142754", "0.45784816", "0.45425478", "0.45295754", "0.451831", "0.4509088", "0.45066988", "0.44639534", "0.44604987" ]
0.72281325
0
/ END prepareUserSpamRuleConditions Method designed to be overridden by child classes to add to set of conditions.
protected function _prepareUserSpamRuleConditions(array $conditions, array &$fetchOptions, array &$sqlConditions) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _prepareSpamRuleConditions(array $conditions, array &$fetchOptions, array &$sqlConditions)\n {\n }", "public function prepareUserSpamRuleConditions(array $conditions, array &$fetchOptions)\n {\n $db = $this->_getDb();\n $sqlConditions = array();\n\n if (isset($conditions['user_spam_rule_ids']) && !empty($conditions['user_spam_rule_ids'])) {\n $sqlConditions[] = 'user_spam_rule.user_spam_rule_id IN (' . $db->quote($conditions['user_spam_rule_ids']) . ')';\n } else if (isset($conditions['user_spam_rule_id'])) {\n $sqlConditions[] = 'user_spam_rule.user_spam_rule_id = ' . $db->quote($conditions['user_spam_rule_id']);\n }\n\n $this->_prepareUserSpamRuleConditions($conditions, $fetchOptions, $sqlConditions);\n\n return $this->getConditionsForClause($sqlConditions);\n }", "public function prepareSpamRuleConditions(array $conditions, array &$fetchOptions)\n {\n $db = $this->_getDb();\n $sqlConditions = array();\n\n if (isset($conditions['spam_rule_ids']) && !empty($conditions['spam_rule_ids'])) {\n $sqlConditions[] = 'spam_rule.spam_rule_id IN (' . $db->quote($conditions['spam_rule_ids']) . ')';\n } else if (isset($conditions['spam_rule_id'])) {\n $sqlConditions[] = 'spam_rule.spam_rule_id = ' . $db->quote($conditions['spam_rule_id']);\n }\n\n $this->_prepareSpamRuleConditions($conditions, $fetchOptions, $sqlConditions);\n\n return $this->getConditionsForClause($sqlConditions);\n }", "protected function _prepare_restrictions ()\n {\n parent::_prepare_restrictions ();\n\n if (! $this->_returns_no_data ())\n {\n include_once ('webcore/db/query_security.php');\n $restriction = new QUERY_SECURITY_RESTRICTION ($this, $this->_user);\n $sql = $restriction->as_sql (array (Privilege_set_folder, Privilege_set_entry));\n if (! $sql)\n {\n $this->_set_returns_no_data ();\n }\n else\n {\n $this->_calculated_restrictions [] = $sql;\n }\n }\n }", "function scorecardUserCond() {\n //getting all users under this supervisor \n $accessBranchList = $this->_getAccessBranchListArray();\n $accessDeptList = $this->_getAccessDeptListArray();\n $conditions = array();\n\n //$conditions = array();\n if ($accessBranchList != 'all') {\n $branchCndnt = array('User.branch_id' => $accessBranchList);\n $conditions = array_merge($conditions, $branchCndnt);\n }\n\n //$conditions = array();\n if ($accessDeptList != 'all') {\n $deptsCndnt = array('User.department_id' => $accessDeptList);\n $conditions = array_merge($conditions, $deptsCndnt);\n }\n if ($this->Session->read('filterScorecard') != '') {\n\n if ($this->Session->read('filterScorecard.branch_list') != '') {\n $brachCndnt = array('User.branch_id' => $this->Session->read('filterScorecard.branch_list'));\n $conditions = array_merge($conditions, $brachCndnt);\n } else {\n $this->Session->delete('filterData');\n }\n }\n return $conditions;\n }", "protected function _prepareTabRuleConditions(array $conditions, array &$fetchOptions, array &$sqlConditions)\n {\n }", "function ua_webtide_add_if_menu_conditions( $conditions ) {\t$conditions[] = array(\n\t\t'name'\t\t=>\t'User is myBama authenticated',\n\t\t'condition'\t=>\t'is_ua_mybama_cas_authenticated',\n\t\t);\n\t\t\n\t// Is user a WebTide member?\n\t$conditions[] = array(\n\t\t'name'\t\t=>\t'User is WebTide member',\n\t\t'condition'\t=>\t'is_webtide_member',\n\t\t);\n\t\n\t// Are we viewing the page?\n\t$conditions[] = array(\n\t\t'name'\t\t=>\t'Viewing the menu item',\n\t\t'condition'\t=>\t'is_viewing_ua_webtide_link_menu_condition',\n\t\t);\n\n\treturn $conditions;\n\t\n}", "protected function setAdditionalClauses(){}", "protected function explodeConditions() {\n if (!empty($this->conditions)) {\n $value = implode(' ', $this->conditions);\n $this->addQuery('where', $value);\n }\n }", "private function add_default_conditions() {\n\t\tif ( ! $this->should_add_default_conditions ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif( ! $this->has_element_status_condition ) {\n\t\t\t$this->add( $this->has_available_elements() );\n\t\t}\n\n\t\tif( ! $this->has_active_relationship_condition ) {\n\t\t\t$this->add( $this->has_active_relationship() );\n\t\t}\n\t}", "public function prepare_conditions_for_controls() {\n\n\t\t\t$sorted_conditions = array();\n\n\t\t\tforeach ( $this->_conditions as $cid => $instance ) {\n\n\t\t\t\tif ( in_array( $cid, $this->_processed_childs ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$group = $instance->get_group();\n\t\t\t\t$childs = $instance->get_childs();\n\n\t\t\t\tif ( ! isset( $sorted_conditions[ $group ] ) ) {\n\t\t\t\t\t$sorted_conditions[ $group ] = array();\n\t\t\t\t}\n\n\t\t\t\t$current = array(\n\t\t\t\t\t'label' => $instance->get_label(),\n\t\t\t\t);\n\n\t\t\t\tif ( ! empty( $childs ) ) {\n\t\t\t\t\t$current['childs'] = $this->add_condition_childs( $childs );\n\t\t\t\t}\n\n\t\t\t\t$sorted_conditions[ $group ][ $cid ] = $current;\n\n\t\t\t}\n\n\t\t\treturn $sorted_conditions;\n\t\t}", "protected function _prepareUserSpamRuleFetchOptions(array &$fetchOptions, &$selectFields, &$joinTables, &$orderBy)\n {\n }", "public function conditions();", "private function Load_Rules()\n\t{\n\t\t//recipient list for expiration warning\n\t\t//recipient list for expired\n\t\t//days to run is taken care of by cronscheduler\n\n\t\t$this->settings = $this->business_rules->Get_Rule_Set_Component_Parm_Values($this->server->company, self::RULE_COMPONENT_NAME_SHORT);\n\t\t//echo 'Business Rules: ';\n\t\t//print_r($this->settings);\n\n\t\t$indexes = array(self::HRS_WARN_FRAUD,\n\t\t\t\t\t\t self::HRS_WARN_RISK,\n\t\t\t\t\t\t self::EMAIL_WARN_FRAUD,\n\t\t\t\t\t\t self::EMAIL_WARN_RISK,\n\t\t\t\t\t\t self::EMAIL_EXP_FRAUD,\n\t\t\t\t\t\t self::EMAIL_EXP_RISK);\n\t\t\n\t\tforeach($indexes as $idx)\n\t\t{\n\t\t\t//numeric values\n\t\t\tif($idx == self::HRS_WARN_FRAUD || $idx == self::HRS_WARN_RISK)\n\t\t\t{\n\t\t\t\tif(empty($this->settings[$idx]))\n\t\t\t\t\t$this->settings[$idx] = self::HRS_WARN_DEFAULT; //fallback default\n\t\t\t}\n\t\t\t//email lists\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(empty($this->settings[$idx]))\n\t\t\t\t{\n\t\t\t\t\t$this->settings[$idx] = array();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\t\t\t\t\t\n\t\t\t\t\t$this->settings[$idx] = split(\",\", $this->settings[$idx]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->from_address = ECash::getConfig()->COMPANY_SUPPORT_EMAIL;\n\t}", "public function setupCriteria()\n {\n }", "private function spamTester(){\n\t\n\t\t$_SESSION['etchat_'.$this->_prefix.'spam'][]=date('U');\n\n\t\t// do not overload the session array in the case of server performanse, so clear it every 200 entries\n\t\tif (count($_SESSION['etchat_'.$this->_prefix.'spam'])>200) {\n\t\t\tunset($_SESSION['etchat_'.$this->_prefix.'spam']);\n\t\t\t$_SESSION['etchat_'.$this->_prefix.'spam']=array();\n\t\t}\n\n\t\t// 3 messages one after another are allowed, excepting ADMIN/MOD\n\t\tif (count($_SESSION['etchat_'.$this->_prefix.'spam'])>3 && $_SESSION['etchat_'.$this->_prefix.'user_priv']!=\"admin\" && $_SESSION['etchat_'.$this->_prefix.'user_priv']!=\"mod\"){\n\t\n\t\t\t$spam_interval=($_SESSION['etchat_'.$this->_prefix.'spam'][(count($_SESSION['etchat_'.$this->_prefix.'spam'])-1)] - $_SESSION['etchat_'.$this->_prefix.'spam'][(count($_SESSION['etchat_'.$this->_prefix.'spam'])-4)]);\n\t\n\t\t\tif ($spam_interval < 6 ){\t\t\n\t\t\t\t// create new LangXml Object\n\t\t\t\t$langObj = new LangXml();\n\t\t\t\t$lang=$langObj->getLang()->reloader_php[0];\n\t\t\t\tnew SysMessage($this->dbObj, $lang->spam[0]->tagData,(int)$_POST['room'],(int)$_SESSION['etchat_'.$this->_prefix.'user_id']);\n\n\t\t\t\t$_SESSION['etchat_'.$this->_prefix.'spam_warn']++;\n\t\t\n\t\t\t\tif ($_SESSION['etchat_'.$this->_prefix.'spam_warn']>2){\n\t\t\t\t\t// create new Blacklist Object\n\t\t\t\t\t$blObj = new Blacklist($this->dbObj);\n\t\t\t\t\t$blObj->insertUser($_SESSION['etchat_'.$this->_prefix.'user_id'],300);\n\t\t\t\t\t$blObj->userInBlacklist();\n\t\t\t\t\t$blObj->allowedToAndSetCookie();\n\t\t\t\t\t$blObj->killUserSession();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse return false;\t\t\n\t\t\t}\n\t\t}\t\n\t\n\t}", "function TanTanSpamFilter() {\n $this->patternsToDieOn = array('\\[url=.*\\]');\n $this->wordsToDieOn = array('cialis','ebony','nude','porn','porno','pussy','upskirt','ringtones','phentermine','viagra');\n \n add_action('preprocess_comment', array(&$this,'comment_handler'), -100); // run before everything\n\n add_action('admin_menu', array(&$this, 'admin_menu'));\n\n\t\t// Handle spams flagged by Akismet \n\t\t// You could modify this action to hook into other spam plugins\n add_action('akismet_spam_caught', array(&$this, 'akismet_spam_handler')); // handle akisment spam\n }", "public function normalize_conditions_input( $email_data ) {\n if ( !isset( $email_data['requirements'] ) ) {\n return $email_data;\n }\n\n $normalized = array();\n\n foreach ( $email_data['requirements'] as $req ) {\n\n if ( $req['condition'] == 'bought_products' ) {\n $req['products'] = '';\n if ( is_array( $req['value'] ) && !empty( $req['value'] ) ) {\n $req['products'] = implode( ',', $req['value'] );\n $req['value'] = '';\n }\n } elseif ( $req['condition'] == 'bought_categories' ) {\n if ( !is_array( $req['value'] ) ) {\n $req['value'] = array( $req['value'] );\n }\n\n $req['categories'] = $req['value'];\n $req['value'] = '';\n }\n\n $normalized[] = $req;\n\n }\n\n $email_data['conditions'] = $normalized;\n unset( $email_data['requirements'] );\n\n return $email_data;\n }", "protected function setCheckOutConditions( )\n {\n if(!empty(self::$input))\n {\n $this->tmpArray = self::$input;\n\n // check the conditions\n foreach ($this->checkOption AS $key=>$value)\n { //key=auth, value = conditions\n if(! array_key_exists($key, self::$input ))\n { // key not defined inside input then use default\n\n $this->condition[\"$key\"] = self::${$key};\n } else {\n $this->condition[\"$key\"] = self::$input[\"$key\"];\n }\n\n }\n\n } else {\n $message = \"Error using function \" . __FUNCTION__ . \"() \";\n $message .= \"the internal array set by setCondition() is empty\";\n throw new Exception ($message);\n }\n\n\n }", "protected function prepare() {\n $this->checkConditions();\n return $this;\n }", "protected function _addSpamBlocks()\n {\n if (!$this->_validRule(Ingo_Storage::ACTION_SPAM)) {\n return;\n }\n\n $spam = $this->_params['storage']\n ->retrieve(Ingo_Storage::ACTION_SPAM);\n if ($spam === false) {\n return;\n }\n\n $this->_addItem(Ingo::RULE_SPAM, new Ingo_Script_Sieve_Comment(_(\"Spam Filter\")));\n\n $actions = array();\n $actions[] = new Ingo_Script_Sieve_Action_Fileinto(array_merge($this->_params, array('folder' => $spam->getSpamFolder())));\n\n if ($this->_params['spam_compare'] == 'numeric') {\n $vals = array(\n 'headers' => $this->_params['spam_header'],\n 'comparison' => 'ge',\n 'value' => $spam->getSpamLevel(),\n );\n $test = new Ingo_Script_Sieve_Test_Relational($vals);\n } elseif ($this->_params['spam_compare'] == 'string') {\n $vals = array(\n 'headers' => $this->_params['spam_header'],\n 'match-type' => ':contains',\n 'strings' => str_repeat($this->_params['spam_char'],\n $spam->getSpamLevel()),\n 'comparator' => 'i;ascii-casemap',\n );\n $test = new Ingo_Script_Sieve_Test_Header($vals);\n }\n\n $actions[] = new Ingo_Script_Sieve_Action_Stop();\n\n $if = new Ingo_Script_Sieve_If($test);\n $if->setActions($actions);\n $this->_addItem(Ingo::RULE_SPAM, $if);\n }", "protected function initializeDatabaseQueryRestrictions()\n {\n // $this->whereClause is used only to select templates from sys_template.\n // $GLOBALS['SIM_ACCESS_TIME'] is used so that we're able to simulate a later time as a test...\n $this->whereClause = 'AND deleted=0 ';\n if (!$this->getTypoScriptFrontendController()->showHiddenRecords) {\n $this->whereClause .= 'AND hidden=0 ';\n }\n $this->whereClause .= 'AND (starttime<=' . $GLOBALS['SIM_ACCESS_TIME'] . ') AND (endtime=0 OR endtime>' . $GLOBALS['SIM_ACCESS_TIME'] . ')';\n\n // set up the query builder restrictions\n $this->queryBuilderRestrictions = GeneralUtility::makeInstance(DefaultRestrictionContainer::class);\n\n if ($this->getTypoScriptFrontendController()->showHiddenRecords) {\n $this->queryBuilderRestrictions\n ->removeByType(HiddenRestriction::class);\n }\n }", "public function setCachedItems()\n {\n // If this is the current user the object is already loaded\n if ($this->user_id == Current_User::getId()) {\n $user = $_SESSION['User'];\n } else {\n $user = new PHPWS_User($this->user_id);\n }\n\n // If user is a supermoderator...\n if (isset($GLOBALS['Modules']['phpwsbb']) && $user->allow('phpwsbb', 'manage_forums')) {\n $securitylevel = 2;\n }\n // otherwise, check for admin status\n elseif ($user->allow('comments')) {\n $securitylevel = 1;\n }\n // otherwise, this is a regular user\n else {\n $securitylevel = 0;\n }\n\n // Update this user's group membership cache\n $groups = null;\n if ($grouplist = $user->getGroups()) {\n $groups = implode(',', $grouplist);\n }\n\n if ($this->securitylevel != $securitylevel || $this->groups != $groups) {\n $this->securitylevel = $securitylevel;\n $this->groups = $groups;\n $this->saveUser();\n }\n }", "public function set_conditions($condtions)\n\t{\t\n\t\treturn $this->cond = $condtions;\n\t}", "function collectConditions()\n\t {\n\t return array();\n\t }", "private function prepareKeywordConditionsCustomized(array &$sqlConditions, array $conditions, array &$fetchOptions)\n {\n }", "public function configureForUser(\\Gazelle\\User $user): array {\n $permitted = $user->permittedForums();\n if (!empty($permitted)) {\n $cond = ['(f.MinClassRead <= ? OR f.ID IN (' . placeholders($permitted) . '))'];\n $args = array_merge([$user->classLevel()], $permitted);\n } else {\n $cond = ['f.MinClassRead <= ?'];\n $args = [$user->classLevel()];\n }\n $forbidden = $user->forbiddenForums();\n if (!empty($forbidden)) {\n $cond[] = 'f.ID NOT IN (' . placeholders($forbidden) . ')';\n $args = array_merge($args, $forbidden);\n }\n return [$cond, $args];\n }", "public function applyConditions($conditions)\n {\n if(count($conditions) == 0)\n {\n $this->setPoints(intval($this->getItem()->getDistance()));\n \n return null;\n }\n \n foreach($conditions as $condition)\n {\n $apply = true;\n \n foreach($condition->getRequirement() as $requirement)\n {\n switch($requirement['condition'])\n {\n case 'always':\n $apply = $apply & true;\n break;\n case 'is_author':\n $apply = $apply & $this->getItem()->getAuthor() == $this->getUser();\n break;\n case 'mt_distance':\n $apply = $apply & $this->getItem()->getDistance() > $requirement['value'];\n break;\n case 'lt_distance':\n $apply = $apply & $this->getItem()->getDistance() < $requirement['value'];\n break;\n case 'mt_uphill':\n $apply = $apply & $this->getItem()->getUphill() > $requirement['value'];\n break;\n case 'lt_uphill':\n $apply = $apply & $this->getItem()->getUphill() < $requirement['value'];\n break;\n case 'is_easy':\n $apply = $apply & $this->getItem()->getDifficulty() == 'easy';\n break;\n case 'is_moderate':\n $apply = $apply & $this->getItem()->getDifficulty() == 'moderate';\n break;\n case 'is_hard':\n $apply = $apply & $this->getItem()->getDifficulty() == 'hard';\n break;\n case 'is_veryhard':\n $apply = $apply & $this->getItem()->getDifficulty() == 'very hard';\n break;\n case 'is_expertsonly':\n $apply = $apply & $this->getItem()->getDifficulty() == 'experts only';\n break;\n case 'role':\n $apply = $apply & $this->getUser()->getRole()->getId() == $requirement['value'];\n break;\n case 'category':\n if($this->getItem()->getCategory())\n {\n $apply = $apply & $this->getItem()->getCategory()->getId() == $requirement['value'];\n } \n else\n {\n $apply = false;\n }\n \n break;\n default:\n $apply = false;\n break;\n }\n }\n \n if($apply)\n {\n switch($condition->getOperator())\n {\n case '+':\n $this->setPoints($this->getPoints() + $condition->getValue());\n break;\n \n case '-':\n $this->setPoints($this->getPoints() - $condition->getValue());\n break;\n \n case '*':\n $this->setPoints($this->getPoints() * $condition->getValue());\n break;\n \n case '/':\n $this->setPoints($this->getPoints() / $condition->getValue());\n break;\n \n case '=':\n $this->setPoints($condition->getValue());\n break;\n }\n \n //STOP checking for more conditions\n if(!$condition->getGather())\n {\n break;\n }\n }\n }\n }", "protected function prepareForValidation()\n {\n }", "public function prepareFindConditions($conditions)\n\t{\n\t $cond = array();\n\n\t if(isset($conditions['start'])) {\n\t $cond['DATE(Appointment.from_date) >='] = $conditions['start'];\n\t }\n\t if(isset($conditions['end'])) {\n\t $cond['DATE(Appointment.to_date) <='] = $conditions['end'];\n\t }\n\t if(isset($conditions['state'])) {\n\t if($conditions['state'] == 'scheduled') {\n\t $cond['Appointment.attendance_id'] = null;\n\t } else {\n\t $cond['Appointment.state'] = $conditions['state'];\n\t }\n\t }\n\t if(isset($conditions['diary_id'])) {\n\t $cond['Appointment.diary_id'] = $conditions['diary_id'];\n\t }\n\t if(isset($conditions['not'])) {\n\t \t$cond['NOT'][] = $conditions['not'];\n\t $cond['Appointment.diary_id'] = $conditions['diary_id'];\n\t }\n\n\t return $cond;\n\t}" ]
[ "0.6864156", "0.62696576", "0.55395937", "0.54713714", "0.54356194", "0.53909713", "0.52475286", "0.5155997", "0.5117172", "0.50943786", "0.5037417", "0.4989968", "0.49700534", "0.4955127", "0.4909787", "0.48975727", "0.48949993", "0.4883832", "0.4883048", "0.48818994", "0.48808846", "0.48600882", "0.48522395", "0.48385155", "0.4836277", "0.48069087", "0.47942898", "0.47723788", "0.47566226", "0.47559798" ]
0.7349523
0
/ END prepareUserSpamRuleFetchOptions Method designed to be overridden by child classes to add to SQL snippets.
protected function _prepareUserSpamRuleFetchOptions(array &$fetchOptions, &$selectFields, &$joinTables, &$orderBy) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _prepareSpamRuleFetchOptions(array &$fetchOptions, &$selectFields, &$joinTables, &$orderBy)\n {\n }", "public function prepareUserSpamRuleFetchOptions(array &$fetchOptions)\n {\n $selectFields = '';\n $joinTables = '';\n $orderBy = '';\n\n $this->_prepareUserSpamRuleFetchOptions($fetchOptions, $selectFields, $joinTables, $orderBy);\n\n return array(\n 'selectFields' => $selectFields,\n 'joinTables' => $joinTables,\n 'orderClause' => ($orderBy ? \"ORDER BY $orderBy\" : '')\n );\n }", "public function prepareSpamRuleFetchOptions(array &$fetchOptions)\n {\n $selectFields = '';\n $joinTables = '';\n $orderBy = '';\n\n $this->_prepareSpamRuleFetchOptions($fetchOptions, $selectFields, $joinTables, $orderBy);\n\n return array(\n 'selectFields' => $selectFields,\n 'joinTables' => $joinTables,\n 'orderClause' => ($orderBy ? \"ORDER BY $orderBy\" : '')\n );\n }", "protected function _prepareUserSpamRuleConditions(array $conditions, array &$fetchOptions, array &$sqlConditions)\n {\n }", "protected function _prepareTabRuleFetchOptions(array &$fetchOptions, &$selectFields, &$joinTables, &$orderBy)\n {\n }", "public function prepareUserSpamRuleConditions(array $conditions, array &$fetchOptions)\n {\n $db = $this->_getDb();\n $sqlConditions = array();\n\n if (isset($conditions['user_spam_rule_ids']) && !empty($conditions['user_spam_rule_ids'])) {\n $sqlConditions[] = 'user_spam_rule.user_spam_rule_id IN (' . $db->quote($conditions['user_spam_rule_ids']) . ')';\n } else if (isset($conditions['user_spam_rule_id'])) {\n $sqlConditions[] = 'user_spam_rule.user_spam_rule_id = ' . $db->quote($conditions['user_spam_rule_id']);\n }\n\n $this->_prepareUserSpamRuleConditions($conditions, $fetchOptions, $sqlConditions);\n\n return $this->getConditionsForClause($sqlConditions);\n }", "protected function _prepareSpamRuleConditions(array $conditions, array &$fetchOptions, array &$sqlConditions)\n {\n }", "public function prepareSpamRuleConditions(array $conditions, array &$fetchOptions)\n {\n $db = $this->_getDb();\n $sqlConditions = array();\n\n if (isset($conditions['spam_rule_ids']) && !empty($conditions['spam_rule_ids'])) {\n $sqlConditions[] = 'spam_rule.spam_rule_id IN (' . $db->quote($conditions['spam_rule_ids']) . ')';\n } else if (isset($conditions['spam_rule_id'])) {\n $sqlConditions[] = 'spam_rule.spam_rule_id = ' . $db->quote($conditions['spam_rule_id']);\n }\n\n $this->_prepareSpamRuleConditions($conditions, $fetchOptions, $sqlConditions);\n\n return $this->getConditionsForClause($sqlConditions);\n }", "protected function _prepareTabNameFetchOptions(array &$fetchOptions, &$selectFields, &$joinTables, &$orderBy)\n {\n }", "public function prepareTabRuleFetchOptions(array &$fetchOptions)\n {\n $selectFields = '';\n $joinTables = '';\n $orderBy = '';\n\n $this->_prepareTabRuleFetchOptions($fetchOptions, $selectFields, $joinTables, $orderBy);\n\n return array(\n 'selectFields' => $selectFields,\n 'joinTables' => $joinTables,\n 'orderClause' => ($orderBy ? \"ORDER BY $orderBy\" : '')\n );\n }", "public function prepareFieldFetchOptions(array $fetchOptions)\n\t{\n\t\t$selectFields = '';\n\t\t$joinTables = '';\n\n\t\t$db = $this->_getDb();\n\n\t\tif (!empty($fetchOptions['valueUserId']))\n\t\t{\n\t\t\t$selectFields .= ',\n\t\t\t\tfield_value.field_value';\n\t\t\t$joinTables .= '\n\t\t\t\tLEFT JOIN kmk_user_field_value AS field_value ON\n\t\t\t\t\t(field_value.field_id = user_field.field_id AND field_value.user_id = ' . $db->quote($fetchOptions['valueUserId']) . ')';\n\t\t}\n\n\t\treturn array(\n\t\t\t'selectFields' => $selectFields,\n\t\t\t'joinTables' => $joinTables\n\t\t);\n\t}", "function get_pre_query($usersid) {\n global $CFG;\n\n $context = get_context_instance(CONTEXT_SYSTEM);\n $academic_admin = has_capability('block/student_gradeviewer:academicadmin', $context);\n $sports_admin = has_capability('block/student_gradeviewer:sportsadmin', $context);\n //$sports_viewer = has_capability('block/student_gradeviewer:sportsviewgrades', $context);\n\n $table = ($sports_admin) ? \",{$CFG->prefix}block_courseprefs_sportusers spu\" : '';\n // If the user has the admin of academics, then he can see everyone\n // other wise we make a check to see if the user is a sports admin\n if($academic_admin) {\n return array('', '');\n } else if($sports_admin) {\n // Sports admins see all the sport users\n return array($table, \" u.id = spu.usersid\");\n }\n\n $rtn_sql = array();\n // Now that admins are out of the way, we look at individual assignments\n // People assignments happen last\n $fields = array('academics', 'sports', 'person');\n foreach ($fields as $field) {\n $sql = \"SELECT id, path FROM {$CFG->prefix}block_student_{$field}\n WHERE (path != 'NA' OR path != 0)\n AND usersid = {$usersid}\";\n $assignments = get_records_sql_menu($sql); \n\n if($assignments) {\n $function = 'handle_' . $field;\n $rtn_sql[] = $function($assignments, $usersid);\n return array($table, implode(\" OR \", $rtn_sql));\n }\n }\n\n return array($table, implode(\" OR \", $rtn_sql));\n}", "public function getUserSpamRules(array $conditions = array(), array $fetchOptions = array())\n {\n $whereClause = $this->prepareUserSpamRuleConditions($conditions, $fetchOptions);\n\n $sqlClauses = $this->prepareUserSpamRuleFetchOptions($fetchOptions);\n $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);\n\n return $this->fetchAllKeyed($this->limitQueryResults('\n SELECT user_spam_rule.*\n ' . $sqlClauses['selectFields'] . '\n FROM xf_user_spam_rule_waindigo AS user_spam_rule\n ' . $sqlClauses['joinTables'] . '\n WHERE ' . $whereClause . '\n ' . $sqlClauses['orderClause'] . '\n ', $limitOptions['limit'], $limitOptions['offset']\n ), 'user_spam_rule_id');\n }", "private function prepareQuery() {\n\n $this->addWhere('tx_newspaper_article.is_template = 0');\n $this->addWhere('tx_newspaper_article.pid = ' . tx_newspaper_Sysfolder::getInstance()->getPid(new tx_newspaper_Article()));\n $this->addTableReference('tx_newspaper_article');\n\n // Start with text filter: May contain #[uid], so the article with that uid should be returned ONLY\n if ($this->useFilter('text')) {\n if ($this->addConditionForText() == self::TEXT_SEARCH_FOR_UID) {\n return; // Query already built completely ...\n }\n unset($this->input['text']); // Don't add text filter twice ...\n }\n\n // Check section filter then: Might lead to an empty result set, no matter how the other filters are set\n if ($this->useFilter('section')) {\n if ($this->addConditionForSection() === false) {\n return; // No articles in result set\n }\n unset($this->input['section']); // Don't add section filter twice ...\n }\n\n foreach (array_keys($this->input) as $key) {\n if ($this->useFilter($key)) {\n $method = 'addConditionFor' . ucfirst($key);\n if (method_exists($this, $method)) {\n $this->$method();\n }\n }\n }\n\n }", "function extendedforum_get_discussions_flaged($cm) {\n global $CFG, $USER;\n \n \n $sql = \n \"SELECT d.id, s.id AS flaged\n FROM {$CFG->prefix}extendedforum_discussions d\n JOIN {$CFG->prefix}extendedforum_posts p ON p.discussion = d.id\n JOIN {$CFG->prefix}extendedforum_flags s\n ON (s.postid = p.id AND s.userid = $USER->id)\n WHERE d.extendedforum = {$cm->instance}\";\n\n \n if ($flaged_array = get_records_sql($sql)) {\n foreach ($flaged_array as $flag_record) {\n $flaged_array[$flag_record->id] = $flag_record->flaged;\n }\n \n \n return $flaged_array;\n } else {\n return array();\n }\n\n}", "public function preparePostJoinOptions(array $fetchOptions)\n\t{\n\t\t$return = parent::preparePostJoinOptions($fetchOptions);\n\t\tif ($this->_postCacheType)\n\t\t{\n\t\t\t$return['selectFields'] .= ',\n\t\t\t\tpost_cache.* ';\n\t\t\t$return['joinTables'] .= '\n\t\t\t\tLEFT JOIN cmf_post_cache AS post_cache ON\n\t\t\t\t\t(post_cache.post_id = post.post_id AND post_cache.cache_type = ' . $this->_getDb()->quote($this->_postCacheType) . ')';\n\t\t}\n\t\treturn $return;\n\t}", "function group_tools_get_auto_join_pattern_user_options() {\r\n\tstatic $result;\r\n\t\r\n\tif (isset($result)) {\r\n\t\treturn $result;\r\n\t}\r\n\t\r\n\t$result = [\r\n\t\t'name' => elgg_echo('name'),\r\n\t\t'email' => elgg_echo('email'),\r\n\t\t'username' => elgg_echo('username'),\r\n\t];\r\n\t\r\n\t$profile_fields = elgg_get_config('profile_fields');\r\n\tif (empty($profile_fields)) {\r\n\t\treturn $result;\r\n\t}\r\n\t\r\n\tforeach ($profile_fields as $metadata_name => $type) {\r\n\t\t$lan = $metadata_name;\r\n\t\tif (elgg_language_key_exists(\"profile:{$metadata_name}\")) {\r\n\t\t\t$lan = elgg_echo(\"profile:{$metadata_name}\");\r\n\t\t}\r\n\t\t\r\n\t\t$result[$metadata_name] = $lan;\r\n\t}\r\n\t\r\n\treturn $result;\r\n}", "function calcFetchColumns(&$aMailbox, &$aProps) {\n\n $highlight_list = (isset($aProps['config']['highlight_list'])) ? $aProps['config']['highlight_list'] : false;\n $aColumnsDesc = (isset($aProps['columns'])) ? $aProps['columns'] : false;\n\n $aFetchColumns = $aColumnsDesc;\n if (isset($aFetchColumns[SQM_COL_CHECK])) {\n unset($aFetchColumns[SQM_COL_CHECK]);\n }\n\n /*\n * Before we fetch the message headers, check if we need to fetch extra columns\n * to make the message highlighting work\n */\n if (is_array($highlight_list) && count($highlight_list)) {\n $aHighlightColumns = array();\n foreach ($highlight_list as $highlight_list_part) {\n if (trim($highlight_list_part['value'])) {\n $match_type = strtoupper($highlight_list_part['match_type']);\n switch ($match_type) {\n case 'TO_CC':\n $aHighlightColumns[SQM_COL_TO] = true;\n $aHighlightColumns[SQM_COL_CC] = true;\n break;\n case 'TO': $aHighlightColumns[SQM_COL_TO] = true; break;\n case 'CC': $aHighlightColumns[SQM_COL_CC] = true; break;\n case 'FROM': $aHighlightColumns[SQM_COL_FROM] = true; break;\n case 'SUBJECT':$aHighlightColumns[SQM_COL_SUBJ] = true; break;\n }\n }\n }\n $aExtraColumns = array();\n foreach ($aHighlightColumns as $k => $v) {\n if (!isset($aFetchColumns[$k])) {\n $aExtraColumns[] = $k;\n $aFetchColumns[$k] = true;\n }\n }\n if (count($aExtraColumns)) {\n $aProps['extra_columns'] = $aExtraColumns;\n }\n }\n $aMailbox['FETCHHEADERS'] = array_keys($aFetchColumns);\n}", "public static function getFiltered($catsFilter = '1:2:3:4:5:6', $q = '', $userId = '', $type = '')\n {\n $query = \"\n SELECT\n proposals.*,\n MATCH (proposals.title, proposals.body)\n AGAINST ('*{$q}*' IN BOOLEAN MODE) as score,\n category.sub_class as category_sub_class,\n category.class as category_class,\n category.short_title as category_short_title,\n user.display_name as user_display_name,\n user.name as user_name,\n aggs.total_votes as aggs_total_votes,\n aggs.total_dislikes as aggs_total_dislikes\n FROM proposals_view proposals\n LEFT JOIN categories category ON (category.id = proposals.category_id)\n LEFT JOIN users user ON (user.id = proposals.user_id)\n LEFT JOIN vote_aggs aggs ON (proposals.id = aggs.proposal_id) #cats_replacement #order_by\n #limit\n \";\n\n if ($catsFilter !== null && $catsFilter !== '') {\n // $cats = explode(':', $catsQuery);\n $cats = str_replace(':', ',', $catsFilter);\n $query = str_replace(\n ['#cats_replacement', '#order_by'],\n [\"WHERE category_id IN ($cats)\", \"ORDER BY score DESC\"],\n $query\n );\n }\n $query = str_replace(['#cats_replacement', '**'], '', $query);\n switch ($type) {\n case 'most':\n $query = str_replace(['#order_by', '#limit'], ['ORDER BY num_votes DESC, score DESC', ''], $query);\n $props = \\DB::select($query);\n break;\n case 'recent':\n $query = str_replace(array('#limit', '#order_by'),\n array('', 'ORDER BY score desc, proposals.created_at desc'), $query\n );\n $props = \\DB::select($query);\n break;\n case 'current':\n $query = str_replace(array('#limit', '#order_by'), array(' LIMIT 6 ', 'ORDER BY num_votes desc'), $query);\n $props = \\DB::select($query);\n break;\n default:\n $query = str_replace(array('#limit', '#order_by'), array('', 'ORDER BY score DESC '), $query);\n $props = \\DB::select($query);\n }\n // dump($query);\n return $props;\n }", "function prepare_items() {\n\t\tglobal $wpdb, $_wp_column_headers, $screen, $allnum, $pendingnum, $approvednum;\n\t\t$table_note = $wpdb->prefix . \"demon_imagenote\";\n\t\t$table_comment = $wpdb->prefix . \"comments\";\n\t\t$screen = get_current_screen();\n\t\t$filter = ( isset($_REQUEST['filter']) ? $_REQUEST['filter'] : 'all');\n\t\t\n\t\t/* Handle our bulk actions */\n\t\t\t$this->process_bulk_action();\n\t\t\t\n\t\t/* -- Preparing your query -- */\n\t\t\tif( (get_option('demon_image_annotation_comments') == '0') ) {\n\t\t\t\t//with wordpress comment\n\t\t\t\t$queryall = \"SELECT \".$table_note.\".*, \".$table_comment.\".comment_approved FROM \".$table_note.\" LEFT OUTER JOIN \".$table_comment.\" on \".$table_comment.\".comment_ID = \".$table_note.\".note_comment_ID WHERE \".$table_note.\".note_comment_ID != 0\";\n\t\t\t\t\n\t\t\t\t$querypending = \"SELECT \".$table_note.\".*, \".$table_comment.\".comment_approved FROM \".$table_note.\" LEFT OUTER JOIN \".$table_comment.\" on \".$table_comment.\".comment_ID = \".$table_note.\".note_comment_ID WHERE \".$table_note.\".note_comment_ID != 0 AND note_approved = 0\";\n\t\t\t\t\n\t\t\t\t$queryapproved = \"SELECT \".$table_note.\".*, \".$table_comment.\".comment_approved FROM \".$table_note.\" LEFT OUTER JOIN \".$table_comment.\" on \".$table_comment.\".comment_ID = \".$table_note.\".note_comment_ID WHERE \".$table_note.\".note_comment_ID != 0 AND note_approved = 1\";\n\t\t\t} else {\n\t\t\t\t$queryall = \"SELECT * FROM \".$table_note.\" WHERE \".$table_note.\".note_comment_ID = 0\";\n\t\t\t\t$querypending = \"SELECT * FROM \".$table_note.\" WHERE \".$table_note.\".note_comment_ID = 0 AND note_approved = 0\";\n\t\t\t\t$queryapproved = \"SELECT * FROM \".$table_note.\" WHERE \".$table_note.\".note_comment_ID = 0 AND note_approved = 1\";\n\t\t\t}\n\t\t\t\n\t\t\t$wpdb->get_results( $queryall );\n\t\t\t$allnum = $wpdb->num_rows;\n\t\t\t\n\t\t\t$wpdb->get_results( $querypending );\n\t\t\t$pendingnum = $wpdb->num_rows;\n\t\t\t\n\t\t\t$wpdb->get_results( $queryapproved );\n\t\t\t$approvednum = $wpdb->num_rows;\n\t\t\t\n\t\t\t$additionalquery = '';\n\t\t\tif($filter == 'pending'){\n\t\t\t\t$additionalquery = ' AND note_approved = 0';\n\t\t\t}else if($filter == 'approved'){\n\t\t\t\t$additionalquery = ' AND note_approved = 1';\n\t\t\t}\n\t\t\t\n\t\t\t//check is sync with wordpress comment\n\t\t\tif( (get_option('demon_image_annotation_comments') == '0') ) {\n\t\t\t\t//with wordpress comment\n\t\t\t\t$query = \"SELECT \".$table_note.\".*, \".$table_comment.\".comment_approved FROM \".$table_note.\" LEFT OUTER JOIN \".$table_comment.\" on \".$table_comment.\".comment_ID = \".$table_note.\".note_comment_ID WHERE \".$table_note.\".note_comment_ID != 0\".$additionalquery;\n\t\t\t} else {\n\t\t\t\t$query = \"SELECT * FROM \".$table_note.\" WHERE \".$table_note.\".note_comment_ID = 0\".$additionalquery;\n\t\t\t}\n\t\t\t\n\t\t/* -- Ordering parameters -- */\n\t\t\t//Parameters that are going to be used to order the result\n\t\t\t$orderby = !empty($_GET[\"orderby\"]) ? esc_sql($_GET[\"orderby\"]) : 'ASC';\n\t\t\t$order = !empty($_GET[\"order\"]) ? esc_sql($_GET[\"order\"]) : '';\n\t\t\tif(!empty($orderby) & !empty($order)){ $query.=' ORDER BY '.$orderby.' '.$order; } else { $query.= ' ORDER BY note_ID DESC';}\n\t\n\t\t/* -- Pagination parameters -- */\n\t\t\t//Number of elements in your table?\n\t\t\t$totalitems = $wpdb->query($query); //return the total number of affected rows\n\t\t\t//How many to display per page?\n\t\t\t$perpage = 10;\n\t\t\t//Which page is this?\n\t\t\t$paged = !empty($_GET[\"paged\"]) ? esc_sql($_GET[\"paged\"]) : '';\n\t\t\t//Page Number\n\t\t\tif(empty($paged) || !is_numeric($paged) || $paged<=0 ){ $paged=1; }\n\t\t\t//How many pages do we have in total?\n\t\t\t$totalpages = ceil($totalitems/$perpage);\n\t\t\t//adjust the query to take pagination into account\n\t\t\tif(!empty($paged) && !empty($perpage)){\n\t\t\t\t$offset=($paged-1)*$perpage;\n\t\t\t\t$query.=' LIMIT '.(int)$offset.','.(int)$perpage;\n\t\t\t}\n\t\n\t\t/* -- Register the pagination -- */\n\t\t\t$this->set_pagination_args( array(\n\t\t\t\t\"total_items\" => $totalitems,\n\t\t\t\t\"total_pages\" => $totalpages,\n\t\t\t\t\"per_page\" => $perpage,\n\t\t\t) );\n\t\t\t//The pagination links are automatically built according to those parameters\n\t\n\t\t/* -- Register the Columns -- */\n\t\t\t$columns = $this->get_columns();\n\t\t\t$hidden = array();\n\t\t\t$sortable = $this->get_sortable_columns();\n\t\t\t$this->_column_headers = array($columns, $hidden, $sortable);\n\t\t\t\n\t\t/* -- Fetch the items -- */\n\t\t\t$this->items = $wpdb->get_results($query);\n\t}", "public function beforeMysqlLinkSearch(&$options)\n\t{\n\t\tif ($this->in_multiple === 'search') {\n\t\t\tif (is_object($options)) {\n\t\t\t\t$options = [$options];\n\t\t\t}\n\t\t\t$options[] = Dao::limit(10);\n\t\t\t$options[] = $this->count = new Count();\n\t\t\t$this->in_multiple = 'build';\n\t\t}\n\t}", "public function beforeMysqlLinkSearch(&$options)\n\t{\n\t\tif ($this->in_multiple === 'search') {\n\t\t\tif (is_object($options)) {\n\t\t\t\t$options = [$options];\n\t\t\t}\n\t\t\t$options[] = Dao::limit(10);\n\t\t\t$options[] = $this->count = new Count();\n\t\t\t$this->in_multiple = 'build';\n\t\t}\n\t}", "private function replace_fetch_queries() {\n global $avatar_table_name, $avatar_column_name, $avatar_reference_avatar, $avatar_reference_user, $avatar_userid;\n\n //get user table details\n global $usertable, $row_userid;\n\n //get DB prefix\n global $db_prefix;\n\n $filename = \"../server/drivers/Custom.php\";\n $cnts = file_get_contents($filename);\n\n $g_start = \"//CUSTOM_GUESTS_QUERY_START\";\n $g_end = \"//CUSTOM_GUESTS_QUERY_END\";\n\n $double_linked = false;\n\n if ($avatar_reference_avatar != '' && $avatar_reference_user != '') {\n $double_linked = true;\n }\n\n //No need to do AS avatar in any of the queries\n\n\n if ($double_linked) {\n $guests = \"\n \\$query = \\\"SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,f.in_room,a.$avatar_column_name \n FROM frei_session AS f LEFT JOIN $db_prefix$usertable AS u ON u.$row_userid = f.session_id\n LEFT JOIN $db_prefix$avatar_table_name AS a ON u.$avatar_reference_user = a.$avatar_reference_avatar\n WHERE f.time>\\\" . \\$this->online_time2 . \\\"\n AND f.session_id!=\\\" . \\$_SESSION[\\$this->uid . 'usr_ses_id'] . \\\"\n AND f.status!=2\n AND f.status!=0\\\";\\n\";\n } else {\n $guests = \"\n \\$query = \\\"SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,f.in_room,a.$avatar_column_name\n FROM frei_session AS f LEFT JOIN $db_prefix$avatar_table_name AS a ON f.session_id = a.$avatar_userid\n WHERE f.time>\\\" . \\$this->online_time2 . \\\"\n AND f.session_id!=\\\" . \\$_SESSION[\\$this->uid . 'usr_ses_id'] . \\\"\n AND f.status!=2\n AND f.status!=0\\\";\\n\";\n }\n\n $u_start = \"//CUSTOM_USERS_QUERY_START\";\n $u_end = \"//CUSTOM_USERS_QUERY_END\";\n\n if ($double_linked) {\n $users = \"\n \\$query = \\\"SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,f.in_room,a.$avatar_column_name \n FROM frei_session AS f LEFT JOIN $db_prefix$usertable AS u ON u.$row_userid = f.session_id\n LEFT JOIN $db_prefix$avatar_table_name AS a ON u.$avatar_reference_user = a.$avatar_reference_avatar\n WHERE f.time>\\\" . \\$this->online_time2 . \\\"\n AND f.session_id!=\\\" . \\$_SESSION[\\$this->uid . 'usr_ses_id'] . \\\"\n AND f.status!=2\n AND f.status!=0\n AND f.guest=0\\\";\\n\";\n } else {\n $users = \"\n \\$query = \\\"SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,f.in_room,a.$avatar_column_name\n FROM frei_session AS f LEFT JOIN $db_prefix$avatar_table_name AS a ON f.session_id = a.$avatar_userid\n WHERE f.time>\\\" . \\$this->online_time2 . \\\"\n AND f.session_id!=\\\" . \\$_SESSION[\\$this->uid . 'usr_ses_id'] . \\\"\n AND f.status!=2\n AND f.status!=0\n AND f.guest=0\\\";\\n\";\n }\n\n $b_start = \"//CUSTOM_BUDDIES_QUERY_START\";\n $b_end = \"//CUSTOM_BUDDIES_QUERY_END\";\n\n if ($double_linked) {\n $buddies = \"\n \\$query = \\\"SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,f.in_room,a.$avatar_column_name \n FROM frei_session AS f LEFT JOIN $db_prefix$usertable AS u ON u.$row_userid = f.session_id\n LEFT JOIN $db_prefix$avatar_table_name AS a ON u.$avatar_reference_user = a.$avatar_reference_avatar\n WHERE f.time>\\\" . \\$this->online_time2 . \\\"\n AND f.session_id!=\\\" . \\$_SESSION[\\$this->uid . 'usr_ses_id'] . \\\"\n AND f.status!=2\n AND f.status!=0\n AND f.guest=0\\\";\\n\";\n } else {\n $buddies = \"\n \\$query = \\\"SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,f.in_room,a.$avatar_column_name\n FROM frei_session AS f LEFT JOIN $db_prefix$avatar_table_name AS a ON f.session_id = a.$avatar_userid\n WHERE f.time>\\\" . \\$this->online_time2 . \\\"\n AND f.session_id!=\\\" . \\$_SESSION[\\$this->uid . 'usr_ses_id'] . \\\"\n AND f.status!=2\n AND f.status!=0\n AND f.guest=0\\\";\\n\";\n }\n\n //mem eater\n $cnts = $this->preg_replace_pt($g_start, $g_end, $guests, $cnts);\n $cnts = $this->preg_replace_pt($u_start, $u_end, $users, $cnts);\n $cnts = $this->preg_replace_pt($b_start, $b_end, $buddies, $cnts);\n\n file_put_contents($filename, $cnts);\n }", "public function getUserSpamRule(array $conditions = array(), array $fetchOptions = array())\n {\n $userSpamRules = $this->getUserSpamRules($conditions, $fetchOptions);\n\n return reset($userSpamRules);\n }", "abstract protected function getFetchParameters();", "private function setFetchStyle()\n {\n $sql = $this->fetchStatements();\n\n return $this->query($sql, $this->bindings);\n }", "function extendedforum_get_all_discussion_posts($discussionid, $sort, $tracking=false, $hideauthor=0) {\n global $CFG, $USER;\n\n \n $tr_sel = \"\";\n $tr_join = \"\";\n\n if ($tracking) {\n $now = time();\n $cutoffdate = $now - ($CFG->extendedforum_oldpostdays * 24 * 3600);\n $tr_sel = \", fr.id AS postread\";\n $tr_join = \"LEFT JOIN {$CFG->prefix}extendedforum_read fr ON (fr.postid = p.id AND fr.userid = $USER->id)\";\n }\n\n if(!$hideauthor)\n {\n $sql = \"SELECT p.*, u.firstname, u.lastname, u.email, u.picture, u.imagealt $tr_sel, pf.id as postflag , ra.roleid AS role , r.name as rolename\n FROM {$CFG->prefix}extendedforum_posts p\n LEFT JOIN {$CFG->prefix}user u ON p.userid = u.id\n LEFT JOIN {$CFG->prefix}extendedforum_flags pf ON (pf.postid = p.id AND pf.userid = $USER->id)\n INNER JOIN {$CFG->prefix}extendedforum_discussions d ON d.id = p.discussion\n LEFT JOIN {$CFG->prefix}context c ON ( c.instanceid = d.course\n OR c.instanceid =0 ) \n LEFT JOIN {$CFG->prefix}role_assignments ra ON ra.userid = p.userid\n INNER JOIN {$CFG->prefix}role r ON ra.roleid = r.id\n $tr_join\n WHERE p.discussion = $discussionid\n AND c.contextlevel\n IN ( 50, 10 ) \n AND ra.contextid = c.id\n AND r.sortorder\n IN (\n SELECT min( r2.sortorder ) \n FROM {$CFG->prefix}role_assignments ra2, {$CFG->prefix}context c2, {$CFG->prefix}role r2\n WHERE ra2.userid = p.userid\n AND ra2.contextid = c2.id\n AND c2.instanceid\n IN ( d.course, 0 ) \n AND c2.contextlevel\n IN ( 50, 10 ) \n AND c2.contextlevel = (\n\n SELECT max( contextlevel ) \n FROM {$CFG->prefix}role_assignments ra2, {$CFG->prefix}context c2, {$CFG->prefix}role r2\n WHERE ra2.userid =p.userid\n AND ra2.contextid = c2.id\n AND c2.instanceid\n IN ( d.course, 0 ) \n AND c2.contextlevel\n IN ( 50, 10 ) )\n AND ra2.roleid = r2.id \n \n AND ra.contextid in (select max( c2.id )\n FROM {$CFG->prefix}role_assignments ra3 , {$CFG->prefix}context c2\n where ra3.userid = p.userid and ra3.contextid = c2.id\n AND c2.instanceid IN ( d.course, 0 ) AND c2.contextlevel IN ( 50, 10 ) )\n )\n ORDER BY $sort\";\n \n \n \n \n if (!$posts = get_records_sql($sql)) {\n return array();\n }\n }\n else\n {\n $sqlhideauthor = \"SELECT p.* $tr_sel, r.name AS role , r.name as rolename , pf.id as postflag\n FROM {$CFG->prefix}extendedforum_posts p\n INNER JOIN {$CFG->prefix}extendedforum_discussions d ON d.id = p.discussion\n LEFT JOIN {$CFG->prefix}context c ON ( c.instanceid = d.course\n OR c.instanceid =0 ) \n LEFT JOIN {$CFG->prefix}role_assignments ra ON ra.userid = p.userid\n INNER JOIN {$CFG->prefix}role r ON ra.roleid = r.id\n $tr_join\n LEFT JOIN {$CFG->prefix}extendedforum_flags pf ON (pf.postid = p.id AND pf.userid = $USER->id) \n WHERE p.discussion = $discussionid\n AND c.contextlevel\n IN ( 50, 10 ) \n AND ra.contextid = c.id\n AND r.sortorder\n IN (\n SELECT min( r2.sortorder ) \n FROM {$CFG->prefix}role_assignments ra2, {$CFG->prefix}context c2, {$CFG->prefix}role r2\n WHERE ra2.userid = p.userid\n AND ra2.contextid = c2.id\n AND c2.instanceid\n IN ( d.course, 0 ) \n AND c2.contextlevel\n IN ( 50, 10 ) \n AND c2.contextlevel = (\n\n SELECT max( contextlevel ) \n FROM {$CFG->prefix}role_assignments ra2, {$CFG->prefix}context c2, {$CFG->prefix}role r2\n WHERE ra2.userid =p.userid\n AND ra2.contextid = c2.id\n AND c2.instanceid\n IN ( d.course, 0 ) \n AND c2.contextlevel\n IN ( 50, 10 ) )\n AND ra2.roleid = r2.id \n \n AND ra.contextid in (select max( c2.id )\n FROM {$CFG->prefix}role_assignments ra3 , {$CFG->prefix}context c2\n where ra3.userid = p.userid and ra3.contextid = c2.id\n AND c2.instanceid IN ( d.course, 0 ) AND c2.contextlevel IN ( 50, 10 ) )\n\n )\n ORDER BY $sort \";\n \n \n if(!$posts = get_records_sql($sqlhideauthor) )\n {\n \n return array();\n }\n \n }\n \n foreach ($posts as $pid=>$p) {\n if ($tracking) {\n if (extendedforum_tp_is_post_old($p)) {\n $posts[$pid]->postread = true;\n }\n }\n if (!$p->parent) {\n continue;\n }\n if (!isset($posts[$p->parent])) {\n continue; // parent does not exist??\n }\n if (!isset($posts[$p->parent]->children)) {\n $posts[$p->parent]->children = array();\n }\n $posts[$p->parent]->children[$pid] =& $posts[$pid];\n }\n\n return $posts;\n}", "public function prepareKeywordOrderOptionsCustomized(array &$choices, array &$fetchOptions)\n {\n }", "public function prepareOptions(array $options = array(), $joinOnColumn = 'e.guid') {\n if (! $this->includeCollection && ! $this->includeOthers) {\n // return none\n $options['wheres'][] = \"(1 = 2)\";\n return $options;\n }\n $tableAlias = self::getTableAlias();\n $guid = $this->collection ? $this->collection->get('guid') : 0;\n if (empty($options['order_by'])) {\n $options['order_by'] = self::DEFAULT_ORDER;\n }\n global $CONFIG;\n $join = \"JOIN {$CONFIG->dbprefix}xcollection_items {$tableAlias} \"\n . \"ON ({$joinOnColumn} = {$tableAlias}.item AND {$tableAlias}.guid = $guid)\";\n if ($this->includeOthers) {\n $join = \"LEFT {$join}\";\n }\n $options['joins'][] = $join;\n if ($this->includeCollection) {\n $order = \"{$tableAlias}.priority\";\n if ($this->collectionItemsFirst != $this->isReversed) {\n $order = \"- $order\";\n }\n if ($this->collectionItemsFirst) {\n $order .= \" DESC\";\n }\n $options['order_by'] = \"{$order}, {$options['order_by']}\";\n } else {\n $options['wheres'][] = \"({$tableAlias}.item IS NULL)\";\n }\n return $options;\n }", "protected function _prepare_restrictions ()\n {\n parent::_prepare_restrictions ();\n\n if (! $this->_returns_no_data ())\n {\n include_once ('webcore/db/query_security.php');\n $restriction = new QUERY_SECURITY_RESTRICTION ($this, $this->_user);\n $sql = $restriction->as_sql (array (Privilege_set_folder, Privilege_set_entry));\n if (! $sql)\n {\n $this->_set_returns_no_data ();\n }\n else\n {\n $this->_calculated_restrictions [] = $sql;\n }\n }\n }" ]
[ "0.75597024", "0.6823852", "0.6412813", "0.6243797", "0.5931492", "0.58130425", "0.57579494", "0.5161509", "0.50070363", "0.49793977", "0.49750462", "0.4899472", "0.489306", "0.47194284", "0.470828", "0.46356308", "0.46219796", "0.46144974", "0.45529512", "0.4531609", "0.45274666", "0.45274666", "0.4514725", "0.44538662", "0.44400114", "0.44261354", "0.4399878", "0.43702233", "0.43568113", "0.4339581" ]
0.79519385
0
Given: ASearchTracksCommand ItShould: BuildATrackRepositoryCriteria
public function givenASearchTracksCommandItShouldBuildATrackRepositoryCriteria() { $command = SearchTracksCommand::instance( 'an album title', 'a track name', 'a composer', FakeAlbumBuilder::FAKE_ID, self::ANY_PAGE_NUMBER ); $this->trackRepository ->findByCriteria( Argument::that($this->assertTrackRepositoryCriteriaIsBuiltWithProperValues($command)) ) ->shouldBeCalledTimes(1) ->willReturn(ArrayCollection::createEmpty()); $this->searchTracksCommandHandlerInstance()->handle($command); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function givenACommandWhenSomeTracksAreFoundThenTheyShouldBeMappedToTrackResources()\n {\n $command = SearchTracksCommand::instance(\n 'an album title',\n 'a track name',\n 'a composer',\n FakeAlbumBuilder::FAKE_ID,\n self::ANY_PAGE_NUMBER\n );\n\n $this->trackRepository\n ->findByCriteria(Argument::any())\n ->shouldBeCalledTimes(1)\n ->willReturn(ArrayCollection::createFromArray([FakeTrackBuilder::build()]));\n\n /** @var SearchTracksCommandResult $result */\n $result = $this->searchTracksCommandHandlerInstance()->handle($command);\n $firstElement = $result->trackResources()[0];\n\n $this->assertContainsOnlyInstancesOf(TrackResource::class, $result->trackResources());\n $this->assertEquals($firstElement->id(), FakeTrackBuilder::FAKE_ID);\n }", "public function setupCriteria()\n {\n }", "public function buildCriteria()\n\t{\n\t\t$criteria = new Criteria(TracksPeer::DATABASE_NAME);\n\n\t\tif ($this->isColumnModified(TracksPeer::TRACKS_ID)) $criteria->add(TracksPeer::TRACKS_ID, $this->tracks_id);\n\t\tif ($this->isColumnModified(TracksPeer::TRACKS_TITLE)) $criteria->add(TracksPeer::TRACKS_TITLE, $this->tracks_title);\n\t\tif ($this->isColumnModified(TracksPeer::TRACKS_ARTIST)) $criteria->add(TracksPeer::TRACKS_ARTIST, $this->tracks_artist);\n\t\tif ($this->isColumnModified(TracksPeer::PROFILES_ID)) $criteria->add(TracksPeer::PROFILES_ID, $this->profiles_id);\n\t\tif ($this->isColumnModified(TracksPeer::TRACKS_PATH)) $criteria->add(TracksPeer::TRACKS_PATH, $this->tracks_path);\n\t\tif ($this->isColumnModified(TracksPeer::TRACKS_TIME)) $criteria->add(TracksPeer::TRACKS_TIME, $this->tracks_time);\n\t\tif ($this->isColumnModified(TracksPeer::TRACKS_ACCEPTED)) $criteria->add(TracksPeer::TRACKS_ACCEPTED, $this->tracks_accepted);\n\t\tif ($this->isColumnModified(TracksPeer::TRACKS_DATE)) $criteria->add(TracksPeer::TRACKS_DATE, $this->tracks_date);\n\t\tif ($this->isColumnModified(TracksPeer::TRACKS_DELETED)) $criteria->add(TracksPeer::TRACKS_DELETED, $this->tracks_deleted);\n\n\t\treturn $criteria;\n\t}", "public function testGetStoresAssignedToChannel()\n {\n }", "public function testGetStoreReportByChannel()\n {\n\n }", "abstract public function createCriteria(): CriteriaInterface;", "public function testConstructorConditions(IntegrationTester $I)\n {\n // ------------- test for setters(classic) way ----------------\n\n $standardBuilder = new Builder();\n\n $standardBuilder->from(Robots::class)\n ->where(\n 'year > :min: AND year < :max:',\n ['min' => '2013-01-01', 'max' => '2100-01-01'],\n ['min' => PDO::PARAM_STR, 'max' => PDO::PARAM_STR]\n )\n ;\n\n $standardResult = $standardBuilder->getQuery()->execute();\n\n // --------------- test for single condition ------------------\n $params = [\n 'models' => Robots::class,\n 'conditions' => [\n [\n 'year > :min: AND year < :max:',\n ['min' => '2013-01-01', 'max' => '2100-01-01'],\n ['min' => PDO::PARAM_STR, 'max' => PDO::PARAM_STR],\n ],\n ],\n ];\n\n $builderWithSingleCondition = new Builder($params);\n $singleConditionResult = $builderWithSingleCondition->getQuery()->execute();\n\n // ------------- test for multiple conditions ----------------\n\n $params = [\n 'models' => Robots::class,\n 'conditions' => [\n [\n 'year > :min:',\n ['min' => '2000-01-01'],\n ['min' => PDO::PARAM_STR],\n ],\n [\n 'year < :max:',\n ['max' => '2100-01-01'],\n ['max' => PDO::PARAM_STR],\n ],\n ],\n ];\n\n // conditions are merged!\n $builderMultipleConditions = new Builder($params);\n $multipleConditionResult = $builderMultipleConditions->getQuery()->execute();\n\n $expectedPhql = 'SELECT [' . Robots::class . '].* FROM [' . Robots::class . '] WHERE year > :min: AND year < :max:';\n\n /* ------------ ASSERTING --------- */\n\n $I->assertEquals(\n $expectedPhql,\n $standardBuilder->getPhql()\n );\n\n $I->assertInstanceOf(\n Simple::class,\n $standardResult\n );\n\n $I->assertEquals(\n $expectedPhql,\n $builderWithSingleCondition->getPhql()\n );\n\n $I->assertInstanceOf(\n Simple::class,\n $singleConditionResult\n );\n\n $I->assertEquals(\n $expectedPhql,\n $builderMultipleConditions->getPhql()\n );\n\n $I->assertInstanceOf(\n Simple::class,\n $multipleConditionResult\n );\n }", "public function test_likeFindOne() {\n\n }", "public function testGetInventorySnapshotByFilter()\n {\n }", "public function testSearchDocumentsRegenerateWhenDefinedPredicateChanged()\n {\n $tripod = $this->getMock(\n '\\Tripod\\Mongo\\Driver',\n array('getSearchIndexer', 'getDataUpdater'),\n array(\n 'CBD_testing',\n 'tripod_php_testing',\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n\n $tripodUpdate = $this->getMock(\n '\\Tripod\\Mongo\\Updates',\n array('storeChanges'),\n array(\n $tripod,\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n\n $labeller = new \\Tripod\\Mongo\\Labeller();\n $subjectsAndPredicatesOfChange = array(\n $labeller->uri_to_alias(\"http://talisaspire.com/authors/1\")=>array(\"foaf:name\")\n );\n\n $tripodUpdate->expects($this->atLeastOnce())\n ->method('storeChanges')\n ->will($this->returnValue(array(\"subjectsAndPredicatesOfChange\"=>$subjectsAndPredicatesOfChange,\"transaction_id\"=>\"t1234\")));\n\n $tripod->expects($this->atLeastOnce())\n ->method('getDataUpdater')\n ->will($this->returnValue($tripodUpdate));\n\n $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer',\n array('getSearchProvider', 'getImpactedSubjects'),\n array($tripod)\n );\n\n $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider',\n array('deleteDocument','indexDocument'),\n array($tripod)\n );\n\n $searchProvider->expects($this->exactly(3))\n ->method('deleteDocument')\n ->with(\n $this->matchesRegularExpression(\"/http:\\/\\/talisaspire\\.com\\/resources\\/doc(1|2|3)$/\"),\n 'http://talisaspire.com/',\n $this->equalTo(array('i_search_resource')))\n ;\n\n $searchProvider->expects($this->exactly(3))\n ->method('indexDocument');\n\n $searchIndexer->expects($this->atLeastOnce())\n ->method('getSearchProvider')\n ->will($this->returnValue($searchProvider));\n\n $impactedSubjects = array(\n $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/resources/doc1',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing',\n array('i_search_resource')\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock(),\n $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/resources/doc2',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing',\n array('i_search_resource')\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock(),\n $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/resources/doc3',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing',\n array('i_search_resource')\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock()\n );\n\n $impactedSubjects[0]->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n $impactedSubjects[1]->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n $impactedSubjects[2]->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n\n $searchIndexer->expects($this->once())\n ->method('getImpactedSubjects')\n ->with($subjectsAndPredicatesOfChange, 'http://talisaspire.com/')\n ->will($this->returnValue($impactedSubjects));\n\n\n $tripod->expects($this->atLeastOnce())\n ->method('getSearchIndexer')\n ->will($this->returnValue($searchIndexer));\n\n $g1 = $tripod->describeResource(\"http://talisaspire.com/authors/1\");\n $g2 = $tripod->describeResource(\"http://talisaspire.com/authors/1\");\n $g2->add_literal_triple(\"http://talisaspire.com/authors/1\", $g2->qname_to_uri(\"foaf:name\"),\"Bill Shakespeare\" );\n\n $tripod->saveChanges($g1, $g2);\n\n // Now make a change that affects a different search document - Create new document\n $tripod = $this->getMock(\n '\\Tripod\\Mongo\\Driver',\n array('getSearchIndexer'),\n array(\n 'CBD_testing',\n 'tripod_php_testing',\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n\n $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer',\n array('getSearchProvider', 'getImpactedSubjects'),\n array($tripod)\n );\n\n $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider',\n array('deleteDocument','indexDocument'),\n array($tripod)\n );\n\n $searchProvider->expects($this->exactly(1))\n ->method('deleteDocument')\n ->with(\n $this->equalTo(\"http://talisaspire.com/lists/1234\"),\n 'http://talisaspire.com/',\n $this->isEmpty())\n ;\n\n $searchProvider->expects($this->exactly(1))\n ->method('indexDocument');\n\n $searchIndexer->expects($this->atLeastOnce())\n ->method('getSearchProvider')\n ->will($this->returnValue($searchProvider));\n\n $impactedSubject = $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/lists/1234',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing'\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock();\n\n $impactedSubject->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n\n $searchIndexer->expects($this->once())->method('getImpactedSubjects')->will($this->returnValue(array($impactedSubject)));\n\n\n $tripod->expects($this->atLeastOnce())\n ->method('getSearchIndexer')\n ->will($this->returnValue($searchIndexer));\n\n $list = new \\Tripod\\ExtendedGraph();\n $list->add_resource_triple(\"http://talisaspire.com/lists/1234\", RDF_TYPE, \"http://purl.org/vocab/resourcelist/schema#List\");\n $list->add_literal_triple(\"http://talisaspire.com/lists/1234\", \"http://rdfs.org/sioc/spec/name\", \"Testing list\");\n\n $tripod->saveChanges(new \\Tripod\\ExtendedGraph(), $list);\n\n // Regen our search docs for real since this step was overridden in the stub\n $this->tripod->getSearchIndexer()->generateAndIndexSearchDocuments(\n \"http://talisaspire.com/lists/1234\",\n \"http://talisaspire.com/\",\n 'CBD_testing'\n );\n\n // Now make a change to the last document\n $tripod = $this->getMock(\n '\\Tripod\\Mongo\\Driver',\n array('getSearchIndexer'),\n array(\n 'CBD_testing',\n 'tripod_php_testing',\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n\n $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer',\n array('getSearchProvider', 'getImpactedSubjects'),\n array($tripod)\n );\n\n $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider',\n array('deleteDocument','indexDocument'),\n array($tripod)\n );\n\n $impactedSubject = $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/lists/1234',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing',\n array('i_search_list')\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock();\n\n $impactedSubject->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n\n $searchProvider->expects($this->exactly(1))\n ->method('deleteDocument')\n ->with(\n $this->equalTo(\"http://talisaspire.com/lists/1234\"),\n 'http://talisaspire.com/',\n array('i_search_list')\n );\n\n $searchProvider->expects($this->exactly(1))\n ->method('indexDocument');\n\n $searchIndexer->expects($this->atLeastOnce())\n ->method('getSearchProvider')\n ->will($this->returnValue($searchProvider));\n\n $searchIndexer->expects($this->once())->method('getImpactedSubjects')->will($this->returnValue(array($impactedSubject)));\n\n $tripod->expects($this->atLeastOnce())\n ->method('getSearchIndexer')\n ->will($this->returnValue($searchIndexer));\n\n $oldList = $tripod->describeResource(\"http://talisaspire.com/lists/1234\");\n $list = $tripod->describeResource(\"http://talisaspire.com/lists/1234\");\n /** @var ExtendedGraph $list */\n $list->remove_property_values(\"http://talisaspire.com/lists/1234\", \"http://rdfs.org/sioc/spec/name\");\n $list->add_literal_triple(\"http://talisaspire.com/lists/1234\", \"http://rdfs.org/sioc/spec/name\", \"IMPROVED testing list\");\n\n $tripod->saveChanges($oldList, $list);\n\n // Regen our search docs for real since this step was overridden in the stub again\n $this->tripod->getSearchIndexer()->generateAndIndexSearchDocuments(\n \"http://talisaspire.com/lists/1234\",\n \"http://talisaspire.com/\",\n 'CBD_testing'\n );\n }", "public function test_likeFind() {\n\n }", "function matches(Repo $repo);", "function _searchSpopTracks($sock, $queryString) {\n\t$arrayReturn = array();\n\t$arrayResponse = sendSpopCommand($sock,\"search \\\"\" . $queryString . \"\\\"\");\n\n\t$i = 0;\n\t$nItems = sizeof($arrayResponse[\"tracks\"]);\n\twhile ($i < $nItems) {\n\t\t$arrayCurrentEntry = array();\n\t\t$arrayCurrentEntry[\"Type\"] = \"SpopTrack\";\n\t\t$arrayCurrentEntry[\"SpopTrackUri\"] = (string)$arrayResponse[\"tracks\"][$i][\"uri\"];\n\t\t$arrayCurrentEntry[\"Title\"] = $arrayResponse[\"tracks\"][$i][\"title\"];\n\t\t$arrayCurrentEntry[\"Artist\"] = $arrayResponse[\"tracks\"][$i][\"artist\"];\n\t\t$arrayCurrentEntry[\"Album\"] = $arrayResponse[\"tracks\"][$i][\"album\"];\n\n\t\tarray_push($arrayReturn, $arrayCurrentEntry);\n\n\t\t$i++;\n\t}\n\n\t // Extra support for albums\n $i = 0;\n\t$nItems = sizeof($arrayResponse[\"albums\"]);\n\twhile ($i < $nItems) {\n\t\t$arrayCurrentEntry = array();\n\t\t$arrayCurrentEntry[\"Type\"] = \"SpopAlbum\";\n\t\t$arrayCurrentEntry[\"SpopTrackUri\"] = (string)$arrayResponse[\"albums\"][$i][\"uri\"];\n\t\t//$arrayCurrentEntry[\"Title\"] = $arrayResponse[\"albums\"][$i][\"title\"];\n $arrayCurrentEntry[\"Title\"] = \"[\" . $arrayResponse[\"albums\"][$i][\"title\"] . \"]\";\n $arrayCurrentEntry[\"Artist\"] = $arrayResponse[\"albums\"][$i][\"artist\"];\n\t\t$arrayCurrentEntry[\"Album\"] = $arrayResponse[\"albums\"][$i][\"title\"];\n\n\t\tarray_push($arrayReturn, $arrayCurrentEntry);\n\n\t\t$i++;\n\t}\n\treturn $arrayReturn;\n}", "public function testSearch() {\n//\t\tfor (int i = 0; i < 5; i++) {\n//\t\t\tSysprop s = new Sysprop(batsType + i);\n//\t\t\ts.setType(batsType);\n//\t\t\ts.addProperty(\"foo\", \"bat\");\n//\t\t\tbats.add(s);\n//\t\t}\n//\t\tpc.createAll(bats);\n\t\tsleep(1);\n\n\t\t$this->assertNull($this->pc->findById(null));\n\t\t$this->assertNull($this->pc->findById(\"\"));\n\t\t$this->assertNotNull($this->pc->findById($this->u->getId()));\n\t\t$this->assertNotNull($this->pc->findById($this->t->getId()));\n\n\t\t$this->assertTrue(empty($this->pc->findByIds(null)));\n\t\t$this->assertEquals(3, sizeof($this->pc->findByIds(array($this->u->getId(), $this->u1->getId(), $this->u2->getId()))));\n\n\t\t$this->assertTrue(empty($this->pc->findNearby(null, null, 100, 1, 1)));\n\t\t$l1 = $this->pc->findNearby($this->u->getType(), \"*\", 10, 40.60, -73.90);\n\t\t$this->assertFalse(empty($l1));\n\n\t\t$this->assertTrue(empty($this->pc->findNearby(null, null, 100, 1, 1)));\n\t\t$l1 = $this->pc->findNearby($this->u->getType(), \"*\", 10, 40.60, -73.90);\n\t\t$this->assertFalse(empty($l1));\n\n\t\t$this->assertTrue(empty($this->pc->findPrefix(null, null, \"\")));\n\t\t$this->assertTrue(empty($this->pc->findPrefix(\"\", \"null\", \"xx\")));\n\t\t$this->assertFalse(empty($this->pc->findPrefix($this->u->getType(), \"name\", \"Ann\")));\n\n\t\t//$this->assertFalse(empty($this->pc->findQuery(null, null)));\n\t\t$this->assertFalse(empty($this->pc->findQuery(\"\", \"*\")));\n\t\t$this->assertEquals(2, sizeof($this->pc->findQuery($this->a1->getType(), \"country:US\")));\n\t\t$this->assertFalse(empty($this->pc->findQuery($this->u->getType(), \"Ann*\")));\n\t\t$this->assertFalse(empty($this->pc->findQuery($this->u->getType(), \"Ann*\")));\n\t\t$this->assertTrue(sizeof($this->pc->findQuery(null, \"*\")) > 4);\n\n\t\t$p = new Pager();\n\t\t$this->assertEquals(0, $p->count);\n\t\t$res = $this->pc->findQuery($this->u->getType(), \"*\", $p);\n\t\t$this->assertEquals(sizeof($res), $p->count);\n\t\t$this->assertTrue($p->count > 0);\n\n\t\t$this->assertTrue(empty($this->pc->findSimilar($this->t->getType(), \"\", null, null)));\n\t\t$this->assertTrue(empty($this->pc->findSimilar($this->t->getType(), \"\", array(), \"\")));\n\t\t$res = $this->pc->findSimilar($this->s1->getType(), $this->s1->getId(), array(\"properties.text\"), $this->s1->text);\n\t\t$this->assertFalse(empty($res));\n\t\t$this->assertEquals($this->s2->getId(), $res[0]->getId());\n\n\t\t$i0 = sizeof($this->pc->findTagged($this->u->getType(), null));\n\t\t$i1 = sizeof($this->pc->findTagged($this->u->getType(), array(\"two\")));\n\t\t$i2 = sizeof($this->pc->findTagged($this->u->getType(), array(\"one\", \"two\")));\n\t\t$i3 = sizeof($this->pc->findTagged($this->u->getType(), array(\"three\")));\n\t\t$i4 = sizeof($this->pc->findTagged($this->u->getType(), array(\"four\", \"three\")));\n\t\t$i5 = sizeof($this->pc->findTagged($this->u->getType(), array(\"five\", \"three\")));\n\t\t$i6 = sizeof($this->pc->findTagged($this->t->getType(), array(\"four\", \"three\")));\n\n\t\t$this->assertEquals(0, $i0);\n\t\t$this->assertEquals(2, $i1);\n\t\t$this->assertEquals(1, $i2);\n\t\t$this->assertEquals(3, $i3);\n\t\t$this->assertEquals(2, $i4);\n\t\t$this->assertEquals(1, $i5);\n\t\t$this->assertEquals(0, $i6);\n\n\t\t$this->assertFalse(empty($this->pc->findTags(null)));\n\t\t$this->assertFalse(empty($this->pc->findTags(\"\")));\n\t\t$this->assertTrue(empty($this->pc->findTags(\"unknown\")));\n\t\t$this->assertTrue(sizeof($this->pc->findTags($this->t->tag)) >= 1);\n\n\t\t$this->assertEquals(3, sizeof($this->pc->findTermInList($this->u->getType(), \"id\",\n\t\t\t\tarray($this->u->getId(), $this->u1->getId(), $this->u2->getId(), \"xxx\", \"yyy\"))));\n\n\t\t// many terms\n\t\t$terms = array();\n//\t\t$terms[\"type\"] = $this->u->getType();\n\t\t$terms[\"id\"] = $this->u->getId();\n\n\t\t$terms1 = array();\n\t\t$terms1[\"type\"] = null;\n\t\t$terms1[\"id\"] = \" \";\n\n\t\t$terms2 = array();\n\t\t$terms2[\" \"] = \"bad\";\n\t\t$terms2[\"\"] = \"\";\n\n\t\t$this->assertEquals(1, sizeof($this->pc->findTerms($this->u->getType(), $terms, true)));\n\t\t$this->assertTrue(empty($this->pc->findTerms($this->u->getType(), $terms1, true)));\n\t\t$this->assertTrue(empty($this->pc->findTerms($this->u->getType(), $terms2, true)));\n\n\t\t// single term\n\t\t$this->assertTrue(empty($this->pc->findTerms(null, null, true)));\n\t\t$this->assertTrue(empty($this->pc->findTerms($this->u->getType(), array(\"\" => null), true)));\n\t\t$this->assertTrue(empty($this->pc->findTerms($this->u->getType(), array(\"\" => \"\"), true)));\n\t\t$this->assertTrue(empty($this->pc->findTerms($this->u->getType(), array(\"term\" => null), true)));\n\t\t$this->assertTrue(sizeof($this->pc->findTerms($this->u->getType(), array(\"type\" => $this->u->getType()), true)) >= 2);\n\n\t\t$this->assertTrue(empty($this->pc->findWildcard($this->u->getType(), null, null)));\n\t\t$this->assertTrue(empty($this->pc->findWildcard($this->u->getType(), \"\", \"\")));\n\t\t$this->assertFalse(empty($this->pc->findWildcard($this->u->getType(), \"name\", \"An*\")));\n\n\t\t$this->assertTrue($this->pc->getCount(null) > 4);\n\t\t$this->assertNotEquals(0, $this->pc->getCount(\"\"));\n\t\t$this->assertEquals(0, $this->pc->getCount(\"test\"));\n\t\t$this->assertTrue($this->pc->getCount($this->u->getType()) >= 3);\n\n\t\t$this->assertEquals(0, $this->pc->getCount(null, null));\n\t\t$this->assertEquals(0, $this->pc->getCount($this->u->getType(), array(\"id\" => \" \")));\n\t\t$this->assertEquals(1, $this->pc->getCount($this->u->getType(), array(\"id\" => $this->u->getId())));\n\t\t$this->assertTrue($this->pc->getCount(null, array(\"type\" => $this->u->getType())) > 1);\n\t}", "public function buildPkeyCriteria()\n\t{\n\t\t$criteria = new Criteria(TracksPeer::DATABASE_NAME);\n\n\t\t$criteria->add(TracksPeer::TRACKS_ID, $this->tracks_id);\n\n\t\treturn $criteria;\n\t}", "public function testConstructor(IntegrationTester $I)\n {\n $params = [\n 'models' => Robots::class,\n 'columns' => ['id', 'name', 'status'],\n 'conditions' => 'a > 5',\n 'group' => ['type', 'source'],\n 'having' => 'b < 5',\n 'order' => ['name', 'created'],\n 'limit' => 10,\n 'offset' => 15,\n ];\n\n $builder = new Builder($params, $this->container);\n\n $expectedPhql = 'SELECT id, name, status FROM [' . Robots::class . '] '\n . 'WHERE a > 5 GROUP BY [type], [source] '\n . 'HAVING b < 5 ORDER BY [name], [created] '\n . 'LIMIT :APL0: OFFSET :APL1:';\n\n $I->assertEquals($expectedPhql, $builder->getPhql());\n $I->assertEquals($this->container, $builder->getDI());\n }", "public function testReviewFind()\n {\n\n }", "public function testGetStoresBySalesChannel()\n {\n }", "#[@test]\n public function setCriteria() {\n $q= new SelectQuery();\n $c= new Criteria();\n $q->setCriteria($c);\n $this->assertEquals($c, $q->getCriteria());\n }", "function testContainsChannel() {\n $manager = new ChannelManager();\n $id = 1;\n $name = \"addedChannel\";\n $manager->addChannel($id, $name);\n return $manager->containsChannel(1);\n}", "public function testGetNexusParameter()\n {\n }", "public function testSaveReportFilter()\n {\n\n }", "public function testScenarioAnalysis()\n {\n }", "public function search(\\Magento\\Framework\\Api\\Search\\SearchCriteriaInterface $searchCriteria);", "function testSearchDocumentsNotRegeneratedIfChangeIsNotInSearchSpec()\n {\n $tripod = $this->getMock(\n '\\Tripod\\Mongo\\Driver',\n array('getSearchIndexer', 'getDataUpdater'),\n array(\n 'CBD_testing',\n 'tripod_php_testing',\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n\n $tripodUpdate = $this->getMock(\n '\\Tripod\\Mongo\\Updates',\n array('storeChanges'),\n array(\n $tripod,\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n $tripodUpdate->expects($this->atLeastOnce())\n ->method('storeChanges')\n ->will($this->returnValue(array('deletedSubjects'=>array(),\"subjectsAndPredicatesOfChange\"=>array(),\"transaction_id\"=>'t1234')));\n\n $tripod->expects($this->atLeastOnce())\n ->method('getDataUpdater')\n ->will($this->returnValue($tripodUpdate));\n\n $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer',\n array('getSearchProvider', 'update'),\n array($tripod)\n );\n\n $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider',\n array('deleteDocument','indexDocument'),\n array($tripod)\n );\n\n $searchProvider->expects($this->never())\n ->method('deleteDocument');\n\n $searchProvider->expects($this->never())\n ->method('indexDocument');\n\n $searchIndexer->expects($this->any())\n ->method('getSearchProvider')\n ->will($this->returnValue($searchProvider));\n\n $searchIndexer->expects($this->never())\n ->method('update');\n\n\n\n $tripod->expects($this->atLeastOnce())\n ->method('getSearchIndexer')\n ->will($this->returnValue($searchIndexer));\n\n $g1 = $tripod->describeResource(\"http://talisaspire.com/authors/1\");\n $g2 = $tripod->describeResource(\"http://talisaspire.com/authors/1\");\n $g2->add_literal_triple(\"http://talisaspire.com/authors/1\", $g2->qname_to_uri(\"foaf:dob\"),\"1564-04-26\" );\n $tripod->saveChanges($g1, $g2);\n }", "function findBy(array $criteria = array());", "public function testGetStoreReportByProduct()\n {\n\n }", "public function testGetStoreReportByCategory()\n {\n\n }", "public function test_likeFindById() {\n\n }", "public function testPostAnalyticsConversationsDetailsQuery()\n {\n }" ]
[ "0.6354416", "0.5205833", "0.50778496", "0.49291044", "0.49287206", "0.4889655", "0.481714", "0.47906125", "0.47877336", "0.4773943", "0.4761951", "0.47254685", "0.47207794", "0.4718823", "0.46761316", "0.46689498", "0.46617836", "0.46545509", "0.46515596", "0.46127018", "0.459042", "0.4580213", "0.4569533", "0.4538137", "0.4536494", "0.4525871", "0.45140874", "0.4486359", "0.44803554", "0.44782937" ]
0.8348051
0
Given: ASearchTracksCommand When: SomeTracksAreFound Then: TheyShouldBeMappedToTrackResources
public function givenACommandWhenSomeTracksAreFoundThenTheyShouldBeMappedToTrackResources() { $command = SearchTracksCommand::instance( 'an album title', 'a track name', 'a composer', FakeAlbumBuilder::FAKE_ID, self::ANY_PAGE_NUMBER ); $this->trackRepository ->findByCriteria(Argument::any()) ->shouldBeCalledTimes(1) ->willReturn(ArrayCollection::createFromArray([FakeTrackBuilder::build()])); /** @var SearchTracksCommandResult $result */ $result = $this->searchTracksCommandHandlerInstance()->handle($command); $firstElement = $result->trackResources()[0]; $this->assertContainsOnlyInstancesOf(TrackResource::class, $result->trackResources()); $this->assertEquals($firstElement->id(), FakeTrackBuilder::FAKE_ID); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function givenASearchTracksCommandItShouldBuildATrackRepositoryCriteria()\n {\n $command = SearchTracksCommand::instance(\n 'an album title',\n 'a track name',\n 'a composer',\n FakeAlbumBuilder::FAKE_ID,\n self::ANY_PAGE_NUMBER\n );\n\n $this->trackRepository\n ->findByCriteria(\n Argument::that($this->assertTrackRepositoryCriteriaIsBuiltWithProperValues($command))\n )\n ->shouldBeCalledTimes(1)\n ->willReturn(ArrayCollection::createEmpty());\n\n $this->searchTracksCommandHandlerInstance()->handle($command);\n }", "public function testScenarioAnalysis()\n {\n }", "public function testGetInventoryLocations()\n {\n }", "public function testTrackEvent()\n {\n }", "public function test_likeFindOne() {\n\n }", "public function testListSourceAssociations()\n {\n }", "public function testListTargetAssociations()\n {\n }", "public function test_likeFind() {\n\n }", "public function testGetInventorySnapshotByFilter()\n {\n }", "public function testCloudPosCheckFastTrackItemInCourse()\n {\n }", "public function test_likeFindById() {\n\n }", "function _searchSpopTracks($sock, $queryString) {\n\t$arrayReturn = array();\n\t$arrayResponse = sendSpopCommand($sock,\"search \\\"\" . $queryString . \"\\\"\");\n\n\t$i = 0;\n\t$nItems = sizeof($arrayResponse[\"tracks\"]);\n\twhile ($i < $nItems) {\n\t\t$arrayCurrentEntry = array();\n\t\t$arrayCurrentEntry[\"Type\"] = \"SpopTrack\";\n\t\t$arrayCurrentEntry[\"SpopTrackUri\"] = (string)$arrayResponse[\"tracks\"][$i][\"uri\"];\n\t\t$arrayCurrentEntry[\"Title\"] = $arrayResponse[\"tracks\"][$i][\"title\"];\n\t\t$arrayCurrentEntry[\"Artist\"] = $arrayResponse[\"tracks\"][$i][\"artist\"];\n\t\t$arrayCurrentEntry[\"Album\"] = $arrayResponse[\"tracks\"][$i][\"album\"];\n\n\t\tarray_push($arrayReturn, $arrayCurrentEntry);\n\n\t\t$i++;\n\t}\n\n\t // Extra support for albums\n $i = 0;\n\t$nItems = sizeof($arrayResponse[\"albums\"]);\n\twhile ($i < $nItems) {\n\t\t$arrayCurrentEntry = array();\n\t\t$arrayCurrentEntry[\"Type\"] = \"SpopAlbum\";\n\t\t$arrayCurrentEntry[\"SpopTrackUri\"] = (string)$arrayResponse[\"albums\"][$i][\"uri\"];\n\t\t//$arrayCurrentEntry[\"Title\"] = $arrayResponse[\"albums\"][$i][\"title\"];\n $arrayCurrentEntry[\"Title\"] = \"[\" . $arrayResponse[\"albums\"][$i][\"title\"] . \"]\";\n $arrayCurrentEntry[\"Artist\"] = $arrayResponse[\"albums\"][$i][\"artist\"];\n\t\t$arrayCurrentEntry[\"Album\"] = $arrayResponse[\"albums\"][$i][\"title\"];\n\n\t\tarray_push($arrayReturn, $arrayCurrentEntry);\n\n\t\t$i++;\n\t}\n\treturn $arrayReturn;\n}", "public function testGetInventoryLocation()\n {\n }", "public function testGetSitemapEvents()\n {\n }", "function callSample(): void\n{\n $resource = '[RESOURCE]';\n $destinationParent = '[DESTINATION_PARENT]';\n\n analyze_move_sample($resource, $destinationParent);\n}", "public function testGetInventorySnapshotTags()\n {\n }", "public function testGetStoresAssignedToChannel()\n {\n }", "public function testDoContainsWithSecondaryProviderWithHit()\n {\n $this->primaryProvider\n ->expects($this->any())\n ->method('contains')\n ->will($this->returnValue(false));\n\n $this->secondaryProvider\n ->expects($this->any())\n ->method('contains')\n ->will($this->returnValue(true));\n\n $this->assertEquals(true, $this->cache->contains('panda'));\n }", "public function testSearchDocumentsRegenerateWhenDefinedPredicateChanged()\n {\n $tripod = $this->getMock(\n '\\Tripod\\Mongo\\Driver',\n array('getSearchIndexer', 'getDataUpdater'),\n array(\n 'CBD_testing',\n 'tripod_php_testing',\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n\n $tripodUpdate = $this->getMock(\n '\\Tripod\\Mongo\\Updates',\n array('storeChanges'),\n array(\n $tripod,\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n\n $labeller = new \\Tripod\\Mongo\\Labeller();\n $subjectsAndPredicatesOfChange = array(\n $labeller->uri_to_alias(\"http://talisaspire.com/authors/1\")=>array(\"foaf:name\")\n );\n\n $tripodUpdate->expects($this->atLeastOnce())\n ->method('storeChanges')\n ->will($this->returnValue(array(\"subjectsAndPredicatesOfChange\"=>$subjectsAndPredicatesOfChange,\"transaction_id\"=>\"t1234\")));\n\n $tripod->expects($this->atLeastOnce())\n ->method('getDataUpdater')\n ->will($this->returnValue($tripodUpdate));\n\n $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer',\n array('getSearchProvider', 'getImpactedSubjects'),\n array($tripod)\n );\n\n $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider',\n array('deleteDocument','indexDocument'),\n array($tripod)\n );\n\n $searchProvider->expects($this->exactly(3))\n ->method('deleteDocument')\n ->with(\n $this->matchesRegularExpression(\"/http:\\/\\/talisaspire\\.com\\/resources\\/doc(1|2|3)$/\"),\n 'http://talisaspire.com/',\n $this->equalTo(array('i_search_resource')))\n ;\n\n $searchProvider->expects($this->exactly(3))\n ->method('indexDocument');\n\n $searchIndexer->expects($this->atLeastOnce())\n ->method('getSearchProvider')\n ->will($this->returnValue($searchProvider));\n\n $impactedSubjects = array(\n $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/resources/doc1',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing',\n array('i_search_resource')\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock(),\n $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/resources/doc2',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing',\n array('i_search_resource')\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock(),\n $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/resources/doc3',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing',\n array('i_search_resource')\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock()\n );\n\n $impactedSubjects[0]->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n $impactedSubjects[1]->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n $impactedSubjects[2]->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n\n $searchIndexer->expects($this->once())\n ->method('getImpactedSubjects')\n ->with($subjectsAndPredicatesOfChange, 'http://talisaspire.com/')\n ->will($this->returnValue($impactedSubjects));\n\n\n $tripod->expects($this->atLeastOnce())\n ->method('getSearchIndexer')\n ->will($this->returnValue($searchIndexer));\n\n $g1 = $tripod->describeResource(\"http://talisaspire.com/authors/1\");\n $g2 = $tripod->describeResource(\"http://talisaspire.com/authors/1\");\n $g2->add_literal_triple(\"http://talisaspire.com/authors/1\", $g2->qname_to_uri(\"foaf:name\"),\"Bill Shakespeare\" );\n\n $tripod->saveChanges($g1, $g2);\n\n // Now make a change that affects a different search document - Create new document\n $tripod = $this->getMock(\n '\\Tripod\\Mongo\\Driver',\n array('getSearchIndexer'),\n array(\n 'CBD_testing',\n 'tripod_php_testing',\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n\n $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer',\n array('getSearchProvider', 'getImpactedSubjects'),\n array($tripod)\n );\n\n $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider',\n array('deleteDocument','indexDocument'),\n array($tripod)\n );\n\n $searchProvider->expects($this->exactly(1))\n ->method('deleteDocument')\n ->with(\n $this->equalTo(\"http://talisaspire.com/lists/1234\"),\n 'http://talisaspire.com/',\n $this->isEmpty())\n ;\n\n $searchProvider->expects($this->exactly(1))\n ->method('indexDocument');\n\n $searchIndexer->expects($this->atLeastOnce())\n ->method('getSearchProvider')\n ->will($this->returnValue($searchProvider));\n\n $impactedSubject = $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/lists/1234',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing'\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock();\n\n $impactedSubject->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n\n $searchIndexer->expects($this->once())->method('getImpactedSubjects')->will($this->returnValue(array($impactedSubject)));\n\n\n $tripod->expects($this->atLeastOnce())\n ->method('getSearchIndexer')\n ->will($this->returnValue($searchIndexer));\n\n $list = new \\Tripod\\ExtendedGraph();\n $list->add_resource_triple(\"http://talisaspire.com/lists/1234\", RDF_TYPE, \"http://purl.org/vocab/resourcelist/schema#List\");\n $list->add_literal_triple(\"http://talisaspire.com/lists/1234\", \"http://rdfs.org/sioc/spec/name\", \"Testing list\");\n\n $tripod->saveChanges(new \\Tripod\\ExtendedGraph(), $list);\n\n // Regen our search docs for real since this step was overridden in the stub\n $this->tripod->getSearchIndexer()->generateAndIndexSearchDocuments(\n \"http://talisaspire.com/lists/1234\",\n \"http://talisaspire.com/\",\n 'CBD_testing'\n );\n\n // Now make a change to the last document\n $tripod = $this->getMock(\n '\\Tripod\\Mongo\\Driver',\n array('getSearchIndexer'),\n array(\n 'CBD_testing',\n 'tripod_php_testing',\n array(\n 'defaultContext'=>'http://talisaspire.com/',\n 'async'=>array(\n OP_VIEWS=>true,\n OP_TABLES=>true,\n OP_SEARCH=>false\n )\n )\n )\n );\n\n $searchIndexer = $this->getMock('\\Tripod\\Mongo\\Composites\\SearchIndexer',\n array('getSearchProvider', 'getImpactedSubjects'),\n array($tripod)\n );\n\n $searchProvider = $this->getMock('\\Tripod\\Mongo\\MongoSearchProvider',\n array('deleteDocument','indexDocument'),\n array($tripod)\n );\n\n $impactedSubject = $this->getMockBuilder('\\Tripod\\Mongo\\ImpactedSubject')\n ->setConstructorArgs(\n array(\n array(\n _ID_RESOURCE=>'http://talisaspire.com/lists/1234',\n _ID_CONTEXT=>'http://talisaspire.com/',\n ),\n OP_SEARCH,\n 'tripod_php_testing',\n 'CBD_testing',\n array('i_search_list')\n )\n )\n ->setMethods(array('getTripod'))\n ->getMock();\n\n $impactedSubject->expects($this->once())->method('getTripod')->will($this->returnValue($tripod));\n\n $searchProvider->expects($this->exactly(1))\n ->method('deleteDocument')\n ->with(\n $this->equalTo(\"http://talisaspire.com/lists/1234\"),\n 'http://talisaspire.com/',\n array('i_search_list')\n );\n\n $searchProvider->expects($this->exactly(1))\n ->method('indexDocument');\n\n $searchIndexer->expects($this->atLeastOnce())\n ->method('getSearchProvider')\n ->will($this->returnValue($searchProvider));\n\n $searchIndexer->expects($this->once())->method('getImpactedSubjects')->will($this->returnValue(array($impactedSubject)));\n\n $tripod->expects($this->atLeastOnce())\n ->method('getSearchIndexer')\n ->will($this->returnValue($searchIndexer));\n\n $oldList = $tripod->describeResource(\"http://talisaspire.com/lists/1234\");\n $list = $tripod->describeResource(\"http://talisaspire.com/lists/1234\");\n /** @var ExtendedGraph $list */\n $list->remove_property_values(\"http://talisaspire.com/lists/1234\", \"http://rdfs.org/sioc/spec/name\");\n $list->add_literal_triple(\"http://talisaspire.com/lists/1234\", \"http://rdfs.org/sioc/spec/name\", \"IMPROVED testing list\");\n\n $tripod->saveChanges($oldList, $list);\n\n // Regen our search docs for real since this step was overridden in the stub again\n $this->tripod->getSearchIndexer()->generateAndIndexSearchDocuments(\n \"http://talisaspire.com/lists/1234\",\n \"http://talisaspire.com/\",\n 'CBD_testing'\n );\n }", "public function testListListings()\n {\n\n }", "public function testCloudPosCheckFastTrackCourse()\n {\n }", "public function testEnableInventoryLocation()\n {\n }", "public function testMatchQuestionToHints()\n {\n $this->withoutExceptionHandling();\n $question = factory(Question::class)->create();\n $hints = factory(Hint::class, 10)->create();\n\n $question->hints()->sync($hints);\n\n for ($i = 0; $i < $hints->count(); $i++) {\n $this->assertDatabaseHas(\n 'hint_question',\n [\n 'question_id' => $question->id,\n 'hint_id' => $hints[$i]->id\n ]\n );\n }\n }", "public function test_likeExistsHeadLikesid() {\n\n }", "public function testGetActorFeatures()\n {\n\n }", "public function testCloudPosCheckFastTrackCheck()\n {\n }", "public function testLookupAspects()\n {\n }", "public function testGetSitemaps()\n {\n }", "public function testStockSplits()\n {\n }", "public function testGetPublisherSuggestion()\n {\n\n }" ]
[ "0.6007868", "0.52258354", "0.51103395", "0.50937194", "0.5049893", "0.502392", "0.5015506", "0.4989881", "0.4898339", "0.4894325", "0.4868789", "0.48467207", "0.48456383", "0.48300806", "0.48173138", "0.48104322", "0.4805451", "0.48005867", "0.47816902", "0.47708985", "0.47698134", "0.47656423", "0.47557524", "0.4738193", "0.47225055", "0.47003132", "0.46817163", "0.46808872", "0.46799606", "0.46744365" ]
0.7803683
0
Get current default option.
public static function getOption() { return self::$default_option; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getDefaultOption()\n {\n return $this->defaultOption;\n }", "public function getDefault() {\n return $this->getOption(self::OPTION_DEFAULT);\n }", "public function get_default_option()\n\t{\n\t if ( isset( $this->properties['default_option'] ) )\n\t {\n\t return $this->properties['default_option'];\n\t }\n\t return null;\n\t}", "public static function getDefault()\n {\n return self::get('default');\n }", "public function getDefaultValue()\n {\n return $this->getProduct()->getPreconfiguredValues()->getData('options/' . $this->getOption()->getId());\n }", "function getOption($default = null) {\n\t\tif (is_null($default)) {\n\t\t\t$model = $this->_defaultModel;\n\t\t} else {\n\t\t\t$model = strtolower($default);\n\t\t}\n\n\t\t// First check to make sure the model requested exists\n\t\tif (isset($this->_models[$model]))\n\t\t{\n\t\t\treturn $this->_models[$model]->get('option');\n\t\t} else {\n\t\t\treturn '';\n\t\t}\n\t}", "public function getDefault()\n {\n return $this->default;\n }", "public function getDefault()\n {\n return $this->default;\n }", "public function getDefault()\n {\n return $this->default;\n }", "public function getDefault()\n {\n return $this->default;\n }", "public function getDefault()\n {\n return $this->default;\n }", "public function getDefault()\n {\n return $this->default;\n }", "public function getDefault()\n {\n return $this->default;\n }", "public function getDefault($option);", "public function getDefault($option);", "public function getDefault()\n {\n return $this->default;\n }", "function getDefault()\n {\n return $this->_default;\n }", "function get_option($name, $default=null) {\r\n $options = $this->get_options();\r\n if (!isset($options[$name]))\r\n return $default;\r\n return $options[$name];\r\n }", "function getOption($name, $default = null) {\n if(isset($this->options[$name])) {\n return $this->options[$name];\n }\n \n return $default;\n }", "public function getDefault(){ return $this->default; }", "protected static function get_option( $default = '0.0' ) {\n\t\tif ( empty( $default ) ) {\n\t\t\t$default = '0.0';\n\t\t}\n\n\t\treturn get_option( 'tge_db_version', $default );\n\t}", "public function getDefaultValue()\n {\n return $this->default;\n }", "public function getDefaultValue()\n {\n return $this->default;\n }", "function get_default_value() {\r\n\t\treturn $this->default_value;\r\n\t}", "public function getDefaultSelected()\n {\n if (count($this->toOptionArray())) {\n return current($this->toOptionArray());\n }\n\n return false;\n }", "public function getDefaultValue() {\n\t\treturn $this->_default;\n\t}", "function drush_get_option($option, $default = NULL, $context = NULL) {\n return $default;\n }", "protected function getOption(string $key, $default = null)\n {\n if (isset($this->options[$key])) {\n return $this->options[$key];\n }\n if (isset($this->defaults[$key])) {\n return $this->defaults[$key];\n }\n\n return $default;\n }", "public function default()\n\t{\n\t\treturn $this->defaultConfig;\n\t}", "public function getDefault() {\n return $this->arDefault;\n }" ]
[ "0.8658577", "0.8470999", "0.8414695", "0.76635057", "0.7643687", "0.7613729", "0.7602845", "0.7602845", "0.7602845", "0.7602845", "0.7602845", "0.7602845", "0.7602845", "0.75667155", "0.75667155", "0.7559409", "0.7527176", "0.7411855", "0.73946184", "0.73160386", "0.73057574", "0.7213639", "0.7213639", "0.7194929", "0.7156025", "0.71452844", "0.71430475", "0.7105538", "0.7105086", "0.7078653" ]
0.8777275
0
Get the file override folder path. Need to add override first for a folder path, if override path not setted, will return origin path.
public static function getOverridePath($path) { if (!empty(self::$overrides[$path])) { return self::$overrides[$path]; } else { return $path; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function getOverridePath()\n\t{\n\t\treturn str_replace([CLASSOVERRIDER_BASE_NS, '\\\\'], [CLASSOVERRIDER_PATH, '/'], $this->class);\n\t}", "private function getDefaultFolder()\n {\n $guard = substr($this->getGuard(), 0, strpos(getenv('guard'), '.'));\n return config(\"theme.themes.\" . $guard . \".default\", config('theme.themes.default.default', 'default'));\n }", "private function getPath()\n {\n if ($this->filePath === null) {\n // phpcs:ignore\n $dirname = pathinfo($this->getFolderName());\n\n if ($dirname['dirname'] == '.') {\n $this->filePath = str_replace('//', '/', $this->directoryList->getRoot() . '/');\n } else {\n $this->filePath = str_replace(\n '//',\n '/',\n $this->directoryList->getRoot() . '/' . $dirname['dirname'] . '/'\n );\n }\n }\n\n return $this->filePath;\n }", "public function getDefaultFolder()\n {\n $this->writeLog('getDefaultFolder()');\n return $this->getRootLevelFolder();\n }", "private function getPathOrigin()\n {\n return base_path($this->path_origin) . \"/\";\n }", "private function getThemeRelativePath()\n {\n $theme = PageTheme::getSiteTheme();\n\n return $this->app->make('environment')->getURL(DIRNAME_THEMES . '/' . $theme->getThemeHandle(), $theme->getPackageHandle());\n }", "public function getRelativeParentFolder()\n {\n return dirname($this->getRelativeFilePath());\n }", "abstract public function get_original_path();", "public function getDefaultFolder();", "public static function getBaseFolder()\n {\n return 'images/upload/' . gmdate('Y/m/d') . '/';\n }", "public function getFolder()\n\t{\n\t\t$folder = $this->setting->get('FOLDER');\n\t\tif(empty($folder))\n\t\t{\n\t\t\t$folder = CTempFile::GetDirectoryName(\n\t\t\t\t4,\n\t\t\t\t[\n\t\t\t\t\t'rest',\n\t\t\t\t\tuniqid($this->context, true)\n\t\t\t\t]\n\t\t\t);\n\t\t\tif(CheckDirPath($folder))\n\t\t\t{\n\t\t\t\t$this->setting->set('FOLDER', $folder);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$folder = false;\n\t\t\t}\n\t\t}\n\n\t\treturn $folder ?: false;\n\t}", "function getPath(){\n $elementData = $this->getData();\n $folder = new folder($elementData['folder']);\n return $folder->getPath();\n }", "private function getDefaultSettingsPath()\n {\n return apply_filters(\n 'lf_configuration_settings_path',\n Loc::lolita()->baseDir() . '/app' . DS . 'config' . DS\n );\n }", "public function getRelativePath()\n {\n return str_replace($this->getRootPath(), null, $this->getPath());\n }", "public function getPath()\n {\n return $this->folder->getPath().'/'.$this->getQualifiedFilename();\n }", "function getBasepath(){\n\t\t// The absolute path of basePath\n\t\treturn realpath($this->basePath);\n\t}", "final public function getRelativeFilePath()\n {\n return $this->file->getRelativeFilePath();\n }", "public function getBasePath(): ?string {\r\n return dirname($this -> file) . DIRECTORY_SEPARATOR;\r\n }", "public function get_sync_path(){\n return !empty($this->get_value('dir_sync')) ? rtrim($this->get_value('dir_sync'), '/') : ABSPATH . 'wp-content/uploads';\n }", "private function getRelativePath()\n\t{\n//\t\t{\n// return 'files';\n//\t\t}\n//\n//\t\treturn $path;\n\n // All files hashed for deduplication will be inside a public/hashed folder\n return 'public/hashed';\n\t}", "function dirPath() {return (\"../../../../\"); }", "public function getParentFolderPath()\n {\n return $this->getParentContainerPath();\n }", "public function getThemePath()\n {\n return $this->getThemeBase() . '/' . $this->getThemeChoice();\n }", "public function getRelativePathDirectory()\n {\n if ($this->getRootPath() == $this->getPathDirectory())\n {\n return '';\n } else {\n return str_replace($this->getRootPath(), null, $this->getPathDirectory());\n }\n }", "private function checkForOverride()\n\t{\n\t\t$overrideFilePath = $this->getOverridePath() . '.php';\n\t\tif(file_exists($overrideFilePath)) {\n\t\t\treturn $overrideFilePath;\n\t\t}\n\n\t\treturn false;\n\t}", "function dirPath() { return (\"../../\"); }", "public function getCurrentThemeLocation(){\r\n\t\t// The default theme is /theme/default\r\n\t\t// Set Path\r\n\t\t$root = str_replace('index.php','',$_SERVER['SCRIPT_FILENAME']).'theme';\r\n\t\tif(isset($_SESSION[db::$config['session_prefix'].'_theme'])){\r\n\t\t\t// Check the theme directory exists...\r\n\t\t\tif(file_exists($root.'/'.$_SESSION[db::$config['session_prefix'].'_theme'].'/theme.txt')){\r\n\t\t\t\t// The file exists...\r\n\t\t\t\t$path = $root.'/'.$_SESSION[db::$config['session_prefix'].'_theme'].'/';\r\n\t\t\t\treturn $path;\r\n\t\t\t}else{\r\n\t\t\t\tunset($_SESSION[db::$config['session_prefix'].'_theme']);\r\n\t\t\t\t// Send back the default path\r\n\t\t\t\t$path = $root.'/default/';\r\n\t\t\t\treturn $path;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t// Send back the default path\r\n\t\t\t$path = $root.'/default/';\r\n\t\t\treturn $path;\r\n\t\t}\r\n\t}", "public function get_base_dir() {\n\t\tif ( ! empty( $this->path_delimiter ) && ! empty( $this->path ) ) {\n\t\t\treturn array_pop( explode( $this->path_delimiter, $this->path ) );\n\t\t}\n\t\treturn;\n\t}", "public function getPathToSiteFiles()\n {\n return sprintf('%s/../../httpdocs', __DIR__);\n }", "public function getPath()\n {\n return $this->getBasePath().$this->getFileName().'.php';\n }" ]
[ "0.6783231", "0.6308643", "0.62779945", "0.6175329", "0.61559004", "0.6118842", "0.60762477", "0.60082096", "0.59981495", "0.59841096", "0.59840024", "0.59819454", "0.5975396", "0.5962456", "0.5872911", "0.5858827", "0.58490455", "0.58480775", "0.5846003", "0.58124334", "0.5804276", "0.58013636", "0.58006513", "0.58005553", "0.5795044", "0.57835007", "0.5774597", "0.5756943", "0.5747463", "0.57335293" ]
0.6870956
0