7 $var = filter_var($args[0], FILTER_VALIDATE_INT);
10 throw new InvalidArgumentException(
"Bad argument to fetch articles");
12 echo ezjscAjaxContent::nodeEncode(eZContentObjectTreeNode::fetch($var), array(
'dataMap'=>array(
'name')));
18 $arg = filter_var($args[0], FILTER_VALIDATE_INT);
21 throw new InvalidArgumentException(
"Bad argument to fetch articles");
23 $node = eZUser::fetch($arg)->contentObject()->mainNode();
27 foreach ($node->children() as $child)
30 $object_id =
$object->attribute(
'id');
33 'id' =>
$object->attribute(
'id'),
34 'name' =>
$object->attribute(
'name'),
35 'is_published' => (bool)eZFunctionHandler::execute(
'ipediatre',
'is_published', array(
'object_id'=>$object_id,
'user_id'=>$arg)),
36 'is_new' => (
bool)eZFunctionHandler::execute(
'ipediatre',
'is_new', array(
'object_id'=>$object_id,
'user_id'=>$arg)),
37 'is_mine' => (bool)eZFunctionHandler::execute(
'ipediatre',
'is_mine', array(
'object_id'=>$object_id,
'user_id'=>$arg)),
45 public static function sort($args)
47 $http = eZHTTPTool::instance();
48 if( !
$http->hasPostVariable(
'node' ) )
50 eZDebug::writeError(
'Fonction de tri par Ajax appelée mais il manquait la liste de noeuds');
53 if( !
$http->hasPostVariable(
'user_id' ) )
55 eZDebug::writeError(
'Fonction de tri par Ajax appelée mais il manquait le user_id');
65 eZContentCacheManager::clearContentCacheIfNeeded(
$UserID );
74 $UserNodeID = eZUser::currentUser()->contentObject()->mainNodeID();
75 $UserNode = eZUser::currentUser()->contentObject()->mainNode();
77 $ParentNodeID =
$article->mainParentNodeID();
84 eZContentCacheManager::clearContentCacheIfNeeded(eZUser::currentUser()->contentObject()->attribute(
'id') );
88 $article->mainNode()->setAttribute(
'priority', 0);
89 eZContentOperationCollection::changeHideStatus(
$NodeID );
90 eZDebug::writeNotice(
"l'article $ObjectID a été publié par son propriétaire",
'ajax');
93 eZDebug::writeNotice(
"l'article $ObjectID a été publié par un pédiatre",
'ajax');
102 $UserNodeID = eZUser::currentUser()->contentObject()->mainNodeID();
105 $ParentNodeID =
$article->mainParentNodeID();
110 eZContentOperationCollection::changeHideStatus(
$NodeID );
111 eZDebug::writeNotice(
"l'article $ObjectID a été dépublié par son propriétaire");
118 eZContentOperationCollection::removeNodes( $to_remove_nodes_id );
119 eZDebug::writeNotice(
"l'article $ObjectID a été dépublié par un pédiatre");
127 list($name, $value) = $args;
128 eZPreferences::storeInSession($name, $value);
134 return eZPreferences::storedSessionValue($name, $value);
138 return json_encode($args);
141 public static function send($args)
143 $mail =
new ezcMail();
144 $http = eZHTTPTool::instance();
145 $ini = eZINI::instance();
146 $user = eZUser::currentUser();
147 $to =
new ezcMailAddress(
'cc@synap.fr',
'Charles-Édouard',
'utf-8');
148 $mail->from =
new ezcMailAddress(
$user->attribute(
'email'),
$user->contentObject()->name(),
'utf-8' );
149 $mail->subject = $subject;
151 $mail->body =
new ezcMailText(ezpI18n::tr(
"\n-- \nThis email has been sent through the iPediatrician contact form"),
'utf-8'); ;
152 $mail->to = array(
$to );
153 $mail->subjectCharset =
'utf-8';
158 $transport->send($mail);
159 $tpl->setVariable(
'success',
true );
160 eZDebug::writeDebug(
"Le module de contact a tenté d'envoyer un email à `{$to}`");
164 eZDebug::writeError(
"Le module de contact a tenté d'envoyer un email à `{$to}` mais l'envoi a échoué: ".$e->getMessage());