function getSubAreas() { $strsql = "SELECT * FROM sub_area WHERE id_grande_area = " . $this->_grande_area->getID(); $rs = $this->_db->databaseQuery($strsql); $subAreas = array(); $sub = new SubArea(); foreach ($rs as $row) { $sub->setID($row['id_sub_area']); $sub->setGrandeAreaID($row['id_grande_area']); $sub->setDescricao($row[$this->_grande_area->getLang()]); array_push($subAreas, $sub); } return $subAreas; }
function generateProfileArticleRelationship($profilesToCreate) { if ($profilesToCreate) { // chamar serviço de associar palavras do perfil com os artigos // deste resultado tratar o xml para // gerar registros na tabela de profile_article, // associando perfil a PID do artigo $trigramaService = new TrigramaService(); $articleDAO = new ArticleDAO(); $profileArticleDAO = new ProfileArticleDAO(); foreach ($profilesToCreate as $newProfile) { $subArea = new SubArea(); $subArea->setID($newProfile->getSubAreaID()); $subArea->loadSubArea(); $grandeArea = new GrandeArea(); $grandeArea->setLang(''); $grandeArea->setID($newProfile->getGrandeAreaID()); $grandeArea->loadGrandeArea(); $trigramaString = ""; $trigramaString .= $newProfile->getProfileText(); $trigramaString .= " " . $subArea->getDescricao(); $trigramaString .= " " . $grandeArea->getDescricao(); $trigramaService->setParams($trigramaString); $articles = $trigramaService->getArticles(); $profileArticleDAO->setAsDeleted($newProfile->getProfileID()); foreach ($articles as $article) { $foundArticle = $articleDAO->getArticle($article->getPID()); if (!$foundArticle || !$foundArticle->getPID()) { $articleDAO->AddArticle($article); } else { $articleDAO->UpdateArticle($article); } $foundProfileArticle = $profileArticleDAO->getProfileArticle($article->getPID(), $newProfile->getProfileID()); $profileArticle = new ProfileArticle(); $profileArticle->setPID($article->getPID()); $profileArticle->setProfileID($newProfile->getProfileID()); $profileArticle->setRelevance($article->getRelevance()); if ($foundProfileArticle->getIsNew() == "3") { $profileArticle->setIsNew(0); $profileArticleDAO->UpdateProfileArticle($profileArticle); } else { $profileArticle->setIsNew(1); $profileArticleDAO->AddProfileArticle($profileArticle); } } $profileArticleDAO->deleteRelationship($newProfile->getProfileID()); } } }
public function toArray() { $array = array('title' => $this->title(), 'link' => $this->link(), 'date' => $this->date()); if ($this->subArea != null) { $array['subarea'] = $this->subArea->toArray(); } if ($this->state != null) { $array['state'] = $this->state->toArray(); } if ($this->event != null) { $array['event'] = $this->getEvent(); } if ($this->duration != null) { $array['duration'] = $this->getDuration(); } return $array; }
function loadSubArea($subArea, $lang = '') { $strsql = "SELECT * FROM sub_area WHERE id_sub_area = " . $subArea->getID(); $row = $this->_db->databaseQuery($strsql); $sub = new SubArea(); $sub->setID($row[0]['id_sub_area']); $sub->setGrandeAreaID($row[0]['id_grande_area']); if ($lang != '') { $sub->setDescricao($row[0][$lang]); } else { /* jah que eh pra trigrama msm vai em todos os idiomas hehehe */ $sub->setDescricao($row[0]['pt'] . $row[0]['en'] . $row[0]['es']); } return $sub; }
public function run() { SubArea::create(array('NombreSubArea' => 'Departamento de Ingeniería de Procesos', 'Objetivo_Id' => 3, 'Area_Id' => 2)); SubArea::create(array('NombreSubArea' => 'Departamento de Ingeniería de Energía', 'Objetivo_Id' => 4, 'Area_Id' => 2)); $this->command->info('SubAreaTableSeeder: Subareas cargadas correctamente'); }
public function getSubareaName() { return $this->subarea->name(); }