Author: Беляев Дмитрий (admin@cogear.ru)
Inheritance: extends Adapter
Ejemplo n.º 1
0
 function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->form = $this->get('Form');
     //check if user access level allows view
     $user = JFactory::getUser();
     $groups = $user->getAuthorisedViewLevels();
     $access = isset($this->form->frontendaccess) && in_array($this->form->frontendaccess, $groups) ? true : false;
     if ($access == false) {
         JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return;
     }
     // get params from menu
     $this->menu_params = $this->state->get('params');
     if ($this->menu_params['menu-meta_description']) {
         $this->document->setDescription($this->menu_params['menu-meta_description']);
     }
     if ($this->menu_params['menu-meta_keywords']) {
         $this->document->setMetadata('keywords', $this->menu_params['menu-meta_keywords']);
     }
     //get Item id d
     $this->itemid = $this->state->get('itemid', '0');
     //get form id
     $this->id = JFactory::getApplication()->input->getInt('id', -1);
     if ($this->_layout == "detail") {
         // Get data from the model
         $this->item = $this->get('Detail');
     }
     // Get data from the model
     $this->form = $this->get('Form');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->fields = $this->get('Datafields');
     parent::display($tpl);
 }
Ejemplo n.º 2
0
 /**
  * Test the basic functions of the collection bag
  *
  * @return void
  * @author Dan Cox
  */
 public function test_gettingSettingCollectionBag()
 {
     $this->collection->add('foo', 'bar');
     $this->assertTrue($this->collection->getMethod()->has('foo'));
     $this->assertEquals('bar', $this->collection->getMethod()->get('foo'));
     $this->assertEquals(array('foo' => 'bar'), $this->collection->getMethod()->all());
 }
Ejemplo n.º 3
0
 public function testEmptyTemperature()
 {
     $A = new Object(array(Object::TEMPERATURE => NULL));
     $B = new Object(array(Object::TEMPERATURE => ''));
     $this->assertTrue($A->weather()->temperature()->isUnknown());
     $this->assertTrue($B->weather()->temperature()->isUnknown());
 }
 /**
  * Prépare une liste de paramètres pour une requête SQL UPDATE ou INSERT
  * @param Object $objetMetier
  * @return array : tableau ordonné de valeurs
  */
 public function objetVersEnregistrement($objetMetier)
 {
     // construire un tableau des paramètres d'insertion ou de modification
     // l'ordre des valeurs est important : il correspond à celui des paramètres de la requête SQL
     $retour = array(':idSpecialite' => $objetMetier->getIdSpecialite(), ':libelleCourt' => $objetMetier->getLibelleCourt(), ':libelleLong' => $objetMetier->getLibelleLong());
     return $retour;
 }
Ejemplo n.º 5
0
 /**
  * @param Object $user
  *
  * @param string $subject
  *
  * @param string $view
  *
  * @param array $data
  *
  */
 public function sendTo($user, $subject, $view, $data = [])
 {
     $this->mail->queue($view, $data, function ($message) use($user, $subject) {
         $message->to($user->email)->subject($subject);
     });
     return true;
 }
Ejemplo n.º 6
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(ERROR_USER_BANNED) . " - " . __(SITE_NAME);
     parent::$PAGE_META_ROBOTS = "noindex, nofollow";
     $can_use_captacha = true;
     if (WspBannedVisitors::isBannedIp($this->getRemoteIP())) {
         $last_access = new DateTime(WspBannedVisitors::getBannedIpLastAccess($this->getRemoteIP()));
         $duration = WspBannedVisitors::getBannedIpDuration($this->getRemoteIP());
         $dte_ban = $last_access->modify("+" . $duration . " seconds");
         if ($dte_ban > new DateTime()) {
             $can_use_captacha = false;
         }
     }
     $obj_error_msg = new Object(new Picture("wsp/img/warning.png", 48, 48, 0, "absmidlle"), "<br/><br/>");
     $obj_error_msg->add(new Label(__(ERROR_USER_BANNED_MSG_1), true), "<br/>");
     if ($can_use_captacha) {
         $obj_error_msg->add(new Label(__(ERROR_USER_BANNED_MSG_2), true), "<br/><br/>");
         $this->captcha_error_obj = new Object();
         $form = new Form($this);
         $this->captcha = new Captcha($form);
         $this->captcha->setFocus();
         $unblock_btn = new Button($form);
         $unblock_btn->setValue(__(ERROR_USER_BUTTON))->onClick("onClickUnblock");
         $form->setContent(new Object($this->captcha, "<br/>", $unblock_btn));
         $obj_error_msg->add($this->captcha_error_obj, "<br/>", $form);
     }
     $obj_error_msg->add("<br/><br/>", __(MAIN_PAGE_GO_BACK), new Link(BASE_URL, Link::TARGET_NONE, __(SITE_NAME)));
     $this->render = new ErrorTemplate($obj_error_msg, __(ERROR_USER_BANNED));
 }
Ejemplo n.º 7
0
 /**
  * Duplicate given object and copy files needed.
  * @param Object $origLayout
  */
 public function duplicateLayout($origLayout)
 {
     // Convert the orig layout to an array
     $origData = $origLayout->toArray();
     // Store this for later use
     $origType = $origData['layout_type'];
     // Unset pieces not needed and reset some pieces
     unset($origData['layout_id']);
     $origData['layout_type'] = Layouts_Model_Layout::CUSTOM;
     $layoutPath = $this->fetchLayoutPath($origType, $origData['layout_module']);
     // Set our source file
     $sourceFile = $layoutPath . $origLayout->createFilename($origData['layout_title_orig']);
     // New Path
     $newPath = $this->fetchLayoutPath(Layouts_Model_Layout::CUSTOM, $origData['layout_module']);
     // Make sure we don't have the same filename
     while (is_file($newPath . $origData['layout_filename'])) {
         $origData['layout_title'] .= ' copy';
         $origData['layout_filename'] = $origLayout->createFilename($origData['layout_title']);
     }
     $newFile = $newPath . $origData['layout_filename'];
     // Do the copy
     $copyResult = copy($sourceFile, $newFile);
     if (!$copyResult) {
         throw new FFR_Model_Exception('There was a problem copying the file.');
     }
     // Save the new DB record
     $newLayout = $this->create($origData);
     $newLayout->save();
     return true;
 }
Ejemplo n.º 8
0
 /**
  * Transforms an object to an id.
  *
  * @param  Object|null $entity
  * @return string
  */
 public function transform($entity)
 {
     if (null === $entity) {
         return "";
     }
     return $entity->getId();
 }
Ejemplo n.º 9
0
 /**
  * send mail
  *
  * array or object of type you set while initialize service
  * @param Object|array $mail
  *
  * @throws \Exception $ex
  *
  * @return Mail
  */
 public function sendMail($mail)
 {
     if (!is_array($mail)) {
         try {
             $arrayMail = $mail->toArray();
         } catch (\Exception $ex) {
             throw new \Exception('impossible to convert ' . get_class($mail) . ' to mail array');
         }
     } else {
         $arrayMail = $mail;
     }
     $this->openTransport();
     $header = $arrayMail['header'];
     $sendingMail = $this->convertor->convertToSendFormat($arrayMail);
     //        prn($sendingMail->toString());
     try {
         $this->transport->send($sendingMail);
     } catch (\Exception $ex) {
         //create checking exception to output normal view, that describes problem to user
         throw new \Exception('Mail format exception. Asc administrator to fix the problem');
         //            throw $ex;
     }
     $headers = $sendingMail->getHeaders()->toArray();
     if (isset($headers['Message-ID'])) {
         $header['message-id'] = $headers['Message-ID'];
     }
     if (is_array($mail)) {
         $mail['header'] = $header;
     } else {
         $mail->header = $header;
     }
     $this->closeTransport();
     return $mail;
 }
Ejemplo n.º 10
0
 /**
  * Tear down test env
  *
  * @return void
  * @author Dan Cox
  */
 public function tearDown()
 {
     m::close();
     if (!is_null($this->DI)) {
         $this->DI->clearMocks();
     }
 }
Ejemplo n.º 11
0
 /**
  * Adds the classteachers given in the array to the ORM-Object $class
  * @param  Object $class              The Object representing the class
  * @param  array  $classteachersArray The array containing the information
  *                                    about the classteachers to be added
  *                                    to $class
  */
 private function classteachersToClassAdd($class, $classteachersArray)
 {
     foreach ($classteachersArray as $ct) {
         $ctId = $ct['ID'];
         if ($ctId == 'CREATE_NEW') {
             //Create a new classteacher
             $classteacher = new \Babesk\ORM\Classteacher();
             $ct['name'] = trim($ct['name']);
             $names = explode(' ', $ct['name'], 2);
             //If there was no space in the Classteachername, only add
             //surname
             $forename = count($names) == 2 ? $names[0] : '';
             $surname = end($names);
             $classteacher->setName($surname)->setForename($forename)->setAddress('')->setTelephone('')->setEmail('');
             $class->addClassteacher($classteacher);
             $this->_em->persist($classteacher);
         } else {
             if ($ctId !== 0) {
                 //Classteacher already exists, add him
                 $classteacher = $this->_em->find('DM:Classteacher', $ctId);
                 $class->addClassteacher($classteacher);
             } else {
                 //No classteacher assigned to class
             }
         }
     }
 }
Ejemplo n.º 12
0
 public function get(Object $oObject, $aParams = array())
 {
     if (isset($this->aParams['ToModuleAlias'])) {
         Core::import('Modules.' . $this->aParams['ToModuleAlias']);
     }
     $oMapper = Manager::getInstance()->getMapper($this->aParams['ToMapperAlias']);
     $nLimit = 0;
     $nOffset = 0;
     $aLocCriteria = array($this->aParams['Field'] => $oObject->getId());
     $aLocOrder = array('Pos' => 'ASC');
     if (count($aParams) > 0) {
         if (isset($aParams['Criteria'])) {
             foreach ($aParams['Criteria'] as $key => $val) {
                 $aLocCriteria[$key] = $val;
             }
         }
         if (isset($aParams['Order'])) {
             $aLocOrder = $aParams['Order'];
         }
         if (isset($aParams['Limit'])) {
             $nLimit = intval($aParams['Limit']);
         }
         if (isset($aParams['Offset'])) {
             $nOffset = intval($aParams['Offset']);
         }
     }
     $aDefaultParams = isset($this->aParams['Params']) ? $this->aParams['Params'] : array();
     return $oMapper->find(ArrayHelper::merge($aDefaultParams, array('Order' => $aLocOrder, 'Criteria' => $aLocCriteria, 'Limit' => $nLimit, 'Offset' => $nOffset)));
 }
Ejemplo n.º 13
0
 /**
  * Display the toolbar.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', 1);
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == User::get('id'));
     $canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     Toolbar::title(Lang::txt('COM_USERS_NOTES'), 'user');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_users', 'core.create')))) {
         Toolbar::apply('note.apply');
         Toolbar::save('note.save');
     }
     if (!$checkedOut && count(User::getAuthorisedCategories('com_users', 'core.create'))) {
         Toolbar::save2new('note.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count(User::getAuthorisedCategories('com_users', 'core.create')) > 0) {
         Toolbar::save2copy('note.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('note.cancel');
     } else {
         Toolbar::cancel('note.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('note');
 }
Ejemplo n.º 14
0
 /**
  * 正常系 ログファイルが生成されるか
  *
  * @covers Lib\SwiftMailer\Init::saveLog()
  * @test testSaveLogNormal()
  */
 public function testSaveLogNormal()
 {
     $mailer = $this->object->getMailer();
     $this->object->saveLog();
     $file = $this->object->getPath();
     $this->assertFileExists($file);
 }
Ejemplo n.º 15
0
 /**
  * Test the expectation trait
  *
  * @return void
  * @author Dan Cox
  */
 public function test_addGetExpectation()
 {
     $this->inputOption->addExpected('test', InputOption::OPTIONAL);
     $expectations = $this->inputOption->getExpected();
     $this->assertTrue(array_key_exists('test', $expectations));
     $this->assertEquals(InputOption::OPTIONAL, $expectations['test']);
 }
Ejemplo n.º 16
0
 /**
  * The function loads config values from Object.
  * 
  * @static
  * @access public
  * @param object $Object The object.
  * @return bool TRUE on success, FALSE on failure.
  */
 public static function loadObject(Object $Object)
 {
     foreach ($Object->findList() as $Item) {
         self::set($Item->Name, @unserialize($Item->Value));
     }
     return true;
 }
Ejemplo n.º 17
0
 /**
  * Executa comando
  *
  * @param Object $oInput
  * @param Object $oOutput
  * @access public
  * @return void
  */
 public function execute($oInput, $oOutput)
 {
     $oOutput->write("baixando atualizações...\r");
     $oComando = $this->getApplication()->execute('cvs update -dRP');
     $aRetornoComandoUpdate = $oComando->output;
     $iStatusComandoUpdate = $oComando->code;
     /**
      * Caso CVS encontre conflito, retorna erro 1
      */
     if ($iStatusComandoUpdate > 1) {
         $oOutput->writeln('<error>Erro nº ' . $iStatusComandoUpdate . ' ao execurar cvs update -dR:' . "\n" . $this->getApplication()->getLastError() . '</error>');
         return $iStatusComandoUpdate;
     }
     $oOutput->writeln(str_repeat(' ', \Shell::columns()) . "\r" . "Atualizações baixados");
     $sComandoRoot = '';
     /**
      * Senha do root
      */
     $sSenhaRoot = $this->getApplication()->getConfig('senhaRoot');
     /**
      * Executa comando como root 
      * - caso for existir senha no arquivo de configuracoes
      */
     if (!empty($sSenhaRoot)) {
         $sComandoRoot = "echo '{$sSenhaRoot}' | sudo -S ";
     }
     $oComando = $this->getApplication()->execute($sComandoRoot . 'chmod 777 -R ' . getcwd());
     $aRetornoComandoPermissoes = $oComando->output;
     $iStatusComandoPermissoes = $oComando->code;
     if ($iStatusComandoPermissoes > 0) {
         throw new Exception("Erro ao atualizar permissões dos arquivos, configura a senha do root: cvsgit config -e");
     }
 }
Ejemplo n.º 18
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(CONFIGURE_BANNED_VISITORS);
     if (!defined('MAX_BAD_URL_BEFORE_BANNED')) {
         define("MAX_BAD_URL_BEFORE_BANNED", 4);
     }
     $this->array_wsp_banned_users = WspBannedVisitors::getBannedVisitors();
     $this->table_ban = new Table();
     $this->table_ban->setId("table_ban")->activateAdvanceTable()->activatePagination()->activateSort(2, "desc")->setWidth(500);
     $this->table_ban->addRowColumns("IP", __(LAST_ACCESS), __(DURATION), __(AUTHORIZE))->setHeaderClass(0);
     $ban_vistors_obj = new Object("<br/><br/>", $this->table_ban, "<br/><br/>");
     $ban_ip_table = new Table();
     $form = new Form($this);
     $this->ip_edt = new TextBox($form);
     $validation = new LiveValidation();
     $validation->addValidatePresence();
     $this->ip_edt->setLiveValidation($validation);
     $this->duration_edt = new TextBox($form);
     $this->duration_edt->setValue(0);
     $validation = new LiveValidation();
     $validation->addValidatePresence()->addValidateNumericality(true);
     $this->duration_edt->setLiveValidation($validation);
     $ip_btn = new Button($form);
     $ip_btn->setValue(__(BAN_IP))->onClick("onBannedIP")->setAjaxEvent();
     $ban_ip_table->addRowColumns("IP : ", $this->ip_edt);
     $ban_ip_table->addRowColumns(__(DURATION) . " : ", $this->duration_edt);
     $form->setContent(new Object($ban_ip_table, $ip_btn));
     $ban_vistors_obj->add($form, "<br/><br/>");
     $this->render = new AdminTemplateForm($this, $ban_vistors_obj);
 }
Ejemplo n.º 19
0
 /**
  * Invoke a target
  *
  * @param   xp.codegen.AbstractGenerator generator
  * @param   lang.reflect.Method method
  * @param   util.collections.HashTable targets
  * @return  var result
  */
 protected static function invoke(AbstractGenerator $generator, Method $method, Object $targets)
 {
     $target = $targets->get($method);
     if ($target->containsKey('result')) {
         return $target['result'][0];
     }
     Console::writeLine('---> Target ', $method->getName(), ': ');
     // Execute dependencies
     if ($target->containsKey('depends')) {
         foreach ($target->get('depends') as $depends) {
             self::invoke($generator, $depends, $targets);
         }
     }
     // Retrieve arguments
     $arguments = array();
     if ($target->containsKey('arguments')) {
         foreach ($target->get('arguments') as $argument) {
             $arguments[] = self::invoke($generator, $argument, $targets);
         }
     }
     // Execute target itself
     $result = $method->invoke($generator, $arguments);
     $target['result'] = new ArrayList($result);
     Console::writeLine(NULL === $result ? '<ok>' : xp::typeOf($result));
     return $result;
 }
Ejemplo n.º 20
0
 /**
  * Test a failing deactivate
  *
  * @return void
  * @author Dan Cox
  */
 public function test_deactivateFail()
 {
     $this->modules->shouldReceive('deactivate')->with('test')->andThrow("Exception");
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName(), 'name' => 'test']);
     $this->assertContains('Failed to deactivate', $CT->getDisplay());
 }
Ejemplo n.º 21
0
 /**
  * Test basic usage of the command tester
  *
  * @return void
  * @author Dan Cox
  */
 public function test_basic()
 {
     $this->CT->execute('utility:main');
     $this->assertContains('The main action', $this->CT->getOutput());
     $this->assertInstanceOf('\\Danzabar\\CLI\\Application', $this->CT->getApplication());
     $this->assertInstanceOf('\\UtilityTask', $this->CT->getTask());
 }
Ejemplo n.º 22
0
 /**
 * apres que le parseur a trouve les champs (mais avant l'action 'charger' des parametres)
 * ajouter automatiquement le parametre 'selecteur_couleur'
 * (ajoute les js du plugin Palette et la librairie farbtastic d'une façon mutualisable entre plugins)
 * 
 * @param mixed $nom # inutilisé
 * @param Object $cfg
 * @return Object
 */
function cfg_charger_cfg_couleur($nom, &$cfg){

	$cfg->param['selecteur_couleur'] = 1;
	$cfg->ajouter_extension_parametre('selecteur_couleur');
	    
	return $cfg;
}
 /**
  * @param Object $demoDataHelper
  */
 public function makeAll(&$demoDataHelper)
 {
     assert('$demoDataHelper instanceof DemoDataHelper');
     $currencies = Currency::getAll('id');
     $productTemplates = array();
     $productTemplateRandomData = self::getProductTemplatesRandomData();
     for ($i = 0; $i < count($productTemplateRandomData['names']); $i++) {
         $productTemplate = new ProductTemplate();
         $currencyIndex = array_rand($currencies);
         $currencyValue = new CurrencyValue();
         $currencyValue->currency = $currencies[$currencyIndex];
         $productTemplate->cost = $currencyValue;
         $currencyValue = new CurrencyValue();
         $currencyValue->currency = $currencies[$currencyIndex];
         $productTemplate->listPrice = $currencyValue;
         $currencyValue = new CurrencyValue();
         $currencyValue->currency = $currencies[$currencyIndex];
         $productTemplate->sellPrice = $currencyValue;
         $this->populateModelData($productTemplate, $i);
         $saved = $productTemplate->save();
         assert('$saved');
         $productTemplates[] = $productTemplate->id;
     }
     $demoDataHelper->setRangeByModelName('ProductTemplate', $productTemplates[0], $productTemplates[count($productTemplates) - 1]);
 }
 /**
  * Transforms an object to a string (id).
  *
  * @param  Object|null $object
  * @return string
  */
 public function transform($object)
 {
     if (null === $object) {
         return "";
     }
     return $object->getId();
 }
Ejemplo n.º 25
0
 function __construct($content, $title)
 {
     parent::__construct();
     define(GOOGLE_CODE_TRACKER_NOT_ACTIF, true);
     $this->render = new Table();
     $this->render->setWidth("100%");
     // Header
     if (defined('SITE_META_OPENGRAPH_IMAGE') && SITE_META_OPENGRAPH_IMAGE != "") {
         $logo = new Picture(SITE_META_OPENGRAPH_IMAGE);
     } else {
         $logo = new Picture("img/logo_128x400_" . $_SESSION['lang'] . ".png", 128, 400);
     }
     $logo->setTitle(__(SITE_NAME));
     $logo_link = new Link($this->getPage()->getBaseLanguageURL(), Link::TARGET_NONE, $logo);
     $img_obj = new Object($logo_link);
     $img_obj->add("<br/><br/>");
     $this->render->addRow($img_obj);
     $this->render->addRow();
     // Error message
     $small_img = new Picture("wsp/img/warning_16.png", 16, 16, 0, "absmiddle");
     $title_header = new Object($small_img, $title);
     $error_box = new Box($title_header, true, Box::STYLE_MAIN, Box::STYLE_MAIN, '', 'error_box', 700);
     $error_box->setContent($content);
     $this->render->addRow($error_box);
 }
Ejemplo n.º 26
0
/**
 *
 * @param string $nom
 * @param Object $cfg
 * @return string
 */
function cfg_pre_traiter_cfg_id($nom, &$cfg){
	
	// lorsque c'est un champ de type multi que l'on modifie 
	// et si l'identifiant a change,  il faut soit le copier, soit de deplacer
	//
	// pour ca, on compare le hidden name='cfg_id' aux champs editables 
	// qui ont la classe css 'cfg_id'
	if ($cfg->champs_id) {
		$new_id = implode('/', array_map('_request', $cfg->champs_id));
		if ($new_id != $cfg->param['cfg_id']){
			// si c'est un deplacement, on efface
			if (!_request('_cfg_copier')) {
				// et ne pas perdre les valeurs suite a l'effacement dans ce cas precis
				$vals = $cfg->val;
				$cfg->effacer();
				$cfg->val = $vals;
			}
			$cfg->param['cfg_id'] = $new_id;
			// recreer un depot avec le nouvel identifiant 
			// (sinon les requetes ne creent pas les bons 'where')
			include_spip('inc/cfg_config');
			$cfg->depot = new cfg_depot($cfg->param['depot'], $cfg->params);
			// recharger le formulaire avec le nouvel identifiant (sinon les parametres 
			// <!-- param=valeur --> de formulaires qui contienent 
			// #ENV{cfg_id} ou #ENV{id} ne sont pas a jour)
			$cfg->formulaire();
		}
	}	
	
	return true;
}
 /**
  * Prépare une liste de paramètres pour une requête SQL UPDATE ou INSERT
  * @param Object $objetMetier
  * @return array : tableau ordonné de valeurs
  */
 public function objetVersEnregistrement($objetMetier)
 {
     // construire un tableau des paramètres d'insertion ou de modification
     // l'ordre des valeurs est important : il correspond à celui des paramètres de la requête SQL
     $retour = array(':anneescol' => $objetMetier->getAnneescol(), ':idpersonne' => $objetMetier->getIdpersonne(), ':numclasse' => $objetMetier->getNumclasse());
     return $retour;
 }
Ejemplo n.º 28
0
/**
 * Prepare array with list of tabs
 *
 * @param   Object	$object		Object related to tabs
 * @return  array				Array of tabs to shoc
 */
function shipping_prepare_head($object)
{
    global $langs, $conf, $user;
    $langs->load("sendings");
    $langs->load("deliveries");
    $h = 0;
    $head = array();
    $head[$h][0] = DOL_URL_ROOT . "/expedition/fiche.php?id=" . $object->id;
    $head[$h][1] = $langs->trans("SendingCard");
    $head[$h][2] = 'shipping';
    $h++;
    if ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire) {
        // delivery link
        $object->fetchObjectLinked($object->id, $object->element);
        if (!empty($object->linkedObjectsIds['delivery'][0])) {
            $head[$h][0] = DOL_URL_ROOT . "/livraison/fiche.php?id=" . $object->linkedObjectsIds['delivery'][0];
            $head[$h][1] = $langs->trans("DeliveryCard");
            $head[$h][2] = 'delivery';
            $h++;
        }
    }
    $head[$h][0] = DOL_URL_ROOT . "/expedition/contact.php?id=" . $object->id;
    $head[$h][1] = $langs->trans("ContactsAddresses");
    $head[$h][2] = 'contact';
    $h++;
    // Show more tabs from modules
    // Entries must be declared in modules descriptor with line
    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
    // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
    complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
    return $head;
}
Ejemplo n.º 29
0
 /**
  * Uses the static method approach if our DI var is null
  *
  * @return Object
  * @author Dan Cox
  */
 public function __get($service)
 {
     if (is_null($this->DI)) {
         return DI::get($service);
     }
     return $this->DI->get($service);
 }
 /**
  * @param Object $pObject
  * @throws \Exception
  */
 public function loadObject(Object $pObject)
 {
     if ($this !== $pObject->getModel()->getSerialization()) {
         throw new \Exception('this serialization mismatch with parameter object serialization');
     }
     return $this->_loadObject($pObject);
 }