Creates a new text item or updates an existing one or a list thereof.

@param stdClass $params Associative array containing the text properties
329360
public function saveItems( stdClass $params )
	{
		$this->_checkParams( $params, array( 'site', 'items' ) );
		$this->_setLocale( $params->site );

		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $this->_createItem( (array) $entry );
			$this->_manager->saveItem( $item );
		}

		return array(
			'items' => $params->items,
			'success' => true,
		);
	}
813144
public function addParameters(&$params)
    {
        $params['grant_type'] = $this->getType();
        $params['username'] = $this->username;
        $params['password'] = $this->password;
    }
1198253
public function getTree( \stdClass $params )
	{
		$this->checkParams( $params, array( 'items' ) );

		$manager = $this->getManager();

		$result = [];
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			if( $entry == 'root' )
			{
				$search = $this->manager->createSearch();
				$search->setConditions( $search->compare( '==', 'locale.site.level', 0 ) );

				$item = $this->manager->createItem();
				$item->setLabel( 'Root' );

				foreach( $this->manager->searchItems( $search ) as $siteItem ) {
					$item->addChild( $siteItem );
				}
			}
			else
			{
				$item = $manager->getTree( $entry, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST );
			}

			$result[] = $this->createNodeArray( $item );
		}

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $result ) : $result ),
			'success' => true,
		);
	}
139160
public function setAdParameters($params)
    {
        $this->adParametersDomElement = $this->getDomElement()->getElementsByTagName('AdParameters')->item(0);
        if (!$this->adParametersDomElement) {
            $this->adParametersDomElement = $this->getDomElement()->ownerDocument->createElement('AdParameters');
            $this->getDomElement()->firstChild->appendChild($this->adParametersDomElement);
        }

        if (is_array($params)) {
            $params = json_encode($params);
        }

        $cdata = $this->adParametersDomElement->ownerDocument->createCDATASection($params);

        // update CData
        if ($this->adParametersDomElement->hasChildNodes()) {
            $this->adParametersDomElement->replaceChild($cdata, $this->adParametersDomElement->firstChild);
        } // insert CData
        else {
            $this->adParametersDomElement->appendChild($cdata);
        }

        return $this;
    }
276403
public function save($params = array())
	{
		if ( isset($this->attributes[$this->primary_column])) {
			return $this->update($params);
		}
		else {
			return $this->create($params);
		}
	}
641904
public function moveItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'items', 'oldparentid', 'newparentid', 'refid' ) );

		$manager = $this->getManager();

		if( $params->newparentid === 'root' ) {
			$params->newparentid = null;
		}

		if( $params->refid === 'root' ) {
			$params->refid = null;
		}

		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $id ) {
			$manager->moveItem( $id, $params->oldparentid, $params->newparentid, $params->refid );
		}

		return array(
			'success' => true,
		);
	}
848067
public function getTree( stdClass $params )
	{
		$this->_checkParams( $params, array( 'site', 'items' ) );
		$this->_setLocale( $params->site );

		$manager = $this->_getManager();

		$result = array();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$entry = ( $entry != 'root' ? $entry : null );
			$item = $manager->getTree( $entry, array(), MW_Tree_Manager_Abstract::LEVEL_LIST );
			$result[] = $this->_createNodeArray( $item );
		}

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $result ) : $result ),
			'success' => true,
		);
	}
952215
public function action_create( $params )
	{
		$name = array_shift( $params );
		
		$file = \DB\Migrator::path( $name );
		
		\CCFile::write( $file, "# ---> up\n\n\n\n# ---> down\n\n" );
	}
1243841
public function add(array $params) {
        foreach ($params as $key => $value) {
            $this->set($key, $value);
        }

        return $this;
    }
800933
public function itemsProcFunc(array &$params)
    {
        if ((int)$params['row']['pid'] > 0 && (int)$params['row']['tx_gridelements_container'] > 0 && isset($params['items'])) {
            $this->checkForAllowedLanguages($params['items'], $params['row']['tx_gridelements_container']);
        }
    }
1294370
public function save(array $params)
    {
        foreach ($params as $method => $param) {
            if (is_array($param) && isset($param[0])) {
                call_user_func_array([$this, $method], $param);
            } else {
                $this->{$method}($param);
            }
        }
    }
454685
public function moveItems( stdClass $params )
	{
		$this->_checkParams( $params, array( 'items', 'oldparentid', 'newparentid', 'refid' ) );

		$manager = $this->_getManager();

		if( $params->newparentid === 'root' ) {
			$params->newparentid = null;
		}

		$refId = ( isset( $params->refid ) ? $params->refid : null );
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry ) {
			$manager->moveItem( $entry, $params->oldparentid, $params->newparentid, $refId );
		}

		return array(
			'success' => true,
		);
	}
708907
public function setParams($params)
    {
        foreach ($params as $name => $value) {
            $this->setParam($name, $value);
        }
        return $this;
    }
537527
public function getUpdates(array $params = [])
    {
        return array_map(function (stdClass $update) {
            return Update::create($update);
        }, $this->request('getUpdates', $params)->getResult());
    }
329951
public function createJob( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );
		$this->setLocale( $params->site );

		$context = $this->getContext();

		$items = (array) $params->items;
		$lang = ( property_exists( $params, 'lang' ) ) ? (array) $params->lang : [];

		$languages = ( !empty( $lang ) ) ? implode( $lang, '-' ) : 'all';

		$result = (object) array(
			'site' => $params->site,
			'items' => array(
				(object) array(
					'job.label' => 'Product text export: ' . $languages,
					'job.method' => 'Product_Export_Text.exportFile',
					'job.parameter' => array(
						'site' => $params->site,
						'items' => $items,
						'lang' => $params->lang,
					),
					'job.status' => 1,
				),
			),
		);

		$jobController = \Aimeos\Controller\ExtJS\Admin\Job\Factory::createController( $context );
		$jobController->saveItems( $result );

		return array(
			'items' => $items,
			'success' => true,
		);
	}
1173348
public function deleteItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );
		$this->setLocale( $params->site );

		$refIds = [];
		$ids = (array) $params->items;
		$manager = $this->getManager();

		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '==', $this->getPrefix() . '.id', $ids ) );
		$search->setSlice( 0, count( $ids ) );

		foreach( $manager->searchItems( $search ) as $item ) {
			$refIds[$item->getDomain()][] = $item->getRefId();
		}

		$manager->deleteItems( $ids );

		if( isset( $refIds['product'] ) )
		{
			$this->rebuildIndex( (array) $refIds['product'] );
			$this->clearCache( (array) $refIds['product'], 'product' );
		}

		return array(
			'items' => $params->items,
			'success' => true,
		);
	}
1129030
public function ajouterActualite($params = array())
    {
        if (isset($this->variablesPost['idActualite']) && $this->variablesPost['idActualite']!='') {
            $d = new dateObject();
            $desactive = 0;
            if (isset($this->variablesPost['desactive']) && $this->variablesPost['desactive']=='1') {
                $desactive = 1;
            }
            $envoi = 0;
            if (isset($this->variablesPost['envoiMailHebdomadaire']) && $this->variablesPost['envoiMailHebdomadaire']=='1') {
                $envoi = 1;
            }
            $req = "INSERT INTO actualites (titre,sousTitre,`date`,texte,urlFichier,fichierPdf,desactive,texteMailHebdomadaire,envoiMailHebdomadaire) VALUES (
            \"".mysql_real_escape_string($this->variablesPost['titre'])."\",
            \"".mysql_real_escape_string($this->variablesPost['sousTitre'])."\",
            \"".$d->toBdd(mysql_real_escape_string($this->variablesPost['date']))."\",
            \"".mysql_real_escape_string($this->variablesPost['texte'])."\",
            \"".mysql_real_escape_string($this->variablesPost['urlFichier'])."\",
            \"".mysql_real_escape_string($this->variablesPost['fichierPdf'])."\",
            '".$desactive."',
            \"".mysql_real_escape_string($this->variablesPost['texteMailHebdomadaire'])."\",
            '".$envoi."'
            ) ";
            $res = $this->connexionBdd->requete($req);

            //\"".mysql_real_escape_string($this->variablesPost['photoIllustration'])."\",
            $idNewActualite = mysql_insert_id();
            if (!file_exists($this->getCheminPhysique()."images/actualites/$idNewActualite/")) {
                mkdir($this->getCheminPhysique()."images/actualites/$idNewActualite/");
            }
            $f = new fileObject();

            // gestion de l'upload
            if (isset($_FILES['photoIllustration']) && !$_FILES['photoIllustration']['error']) {
                $f->handleUploadedFileSimpleMoveTo(array('inputFileName'=>'photoIllustration', 'redimensionneImageConfig'=>array(150=>array('destination'=>$this->getCheminPhysique()."images/actualites/".$idNewActualite."/illustration200.jpg"))));

                // on met a jour la bdd , meme si dans les prochaines actu cela ne sert a rien de garder le champs , vu le fonctionnement, on le garde pour les anciennes actus
                $reqIllustration = "UPDATE actualites SET photoIllustration='illustration200.jpg' WHERE idActualite='".$idNewActualite."' ";
                $resIllustration = $this->connexionBdd->requete($reqIllustration);
            }

            // on verifie dans le repertoire d'uploadMultiple pour voir s'il y a des images a transferer
            if (file_exists($this->getCheminPhysique()."images/uploadMultipleActualites/")) {
                $f->convertDirectoryFilesNamesToUTF8(array('repertoire'=>$this->getCheminPhysique()."images/uploadMultipleActualites/"));
                $arrayFiles = $f->getListeFichiersArrayFrom($this->getCheminPhysique()."images/uploadMultipleActualites/");
                foreach ($arrayFiles as $indice=>$fichier) {
                    // on deplace tous les fichiers dans le repertoire de l'actu , ceux qui auront le meme nom seront ecrasés.
                    if ($fichier!='.' && $fichier!='..') {
                        rename($this->getCheminPhysique()."images/uploadMultipleActualites/".$fichier, $this->getCheminPhysique()."images/actualites/$idNewActualite/".$f->removeSpecialCharFromFileName($fichier));
                    }
                }
                $f->convertDirectoryFilesNamesToUTF8(array('repertoire'=>$this->getCheminPhysique()."images/actualites/$idNewActualite/"));
            }

            // creation automatique du fichier pdf
            if ($this->variablesPost['urlFichier']=='') {

                // evite de creer un fichier pdf pour rien
                $pdfObject = new pdfObject();
                $pdfObject->setContent(stripslashes($this->variablesPost['titre'].$this->variablesPost['sousTitre'].$this->variablesPost['texte']));
                $pdfObject->writeToFile($this->getCheminPhysique()."images/actualites/$idNewActualite/versionPdf.pdf");
                if (file_exists($this->getCheminPhysique()."images/actualites/$idNewActualite/versionPdf.pdf")) {

                    // pas genial , mais c'est pour garder la compatibilié avec les news precedentes qui n'etait pas generee automatiquement en pdf sur lesquelles on precisait le nom du fichier que l'on uploadait a la main 
                    $reqUpdatePdf = "UPDATE actualites SET fichierPdf='versionPdf.pdf' WHERE idActualite = '$idNewActualite'";
                }
                $resUpdatePdf = $this->connexionBdd->requete($reqUpdatePdf);
            }
        }
        if (isset($this->variablesGet['previsualisationMail']) && $this->variablesGet['previsualisationMail']=='1') {
            $auth=new archiAuthentification();
            $preview=isset($_GET["preview"])?"&preview=1":"";
            $testMail=isset($_GET["testMail"])?"&testMail=1":"";
            echo "<script>location.href='".$this->getUrlRacine()."/script/cronMailsNouvellesAdresses.php?modePrevisualisationAdmin=1&idActualite=$idNewActualite&idUtilisateur=".$auth->getIdUtilisateur().$preview.$testMail."';</script>";

            //$this->creerUrl('','', array("modePrevisualisationAdmin"=>1,"idActualite"=>$idActualite,"idUtilisateur"=>$authentification->getIdUtilisateur()))
        }
    }