mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Push & Feedback templates
This commit is contained in:
@@ -472,7 +472,7 @@ class Basket implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* Get a basket
|
* Get a basket
|
||||||
*/
|
*/
|
||||||
$controllers->get('/{basket_id}/', function(Application $app, $basket_id)
|
$controllers->get('/{basket_id}/', function(Application $app, Request $request, $basket_id)
|
||||||
{
|
{
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
@@ -487,7 +487,12 @@ class Basket implements ControllerProviderInterface
|
|||||||
/* @var $twig \Twig_Environment */
|
/* @var $twig \Twig_Environment */
|
||||||
$twig = $app['Core']->getTwig();
|
$twig = $app['Core']->getTwig();
|
||||||
|
|
||||||
$html = $twig->render('prod/WorkZone/Basket.html.twig', array('basket' => $basket));
|
$params = array(
|
||||||
|
'basket' => $basket,
|
||||||
|
'ordre' => $request->get('ordre')
|
||||||
|
);
|
||||||
|
|
||||||
|
$html = $twig->render('prod/WorkZone/Basket.html.twig', $params);
|
||||||
|
|
||||||
return new Response($html);
|
return new Response($html);
|
||||||
})->assert('basket_id', '\d+');
|
})->assert('basket_id', '\d+');
|
||||||
|
@@ -89,8 +89,9 @@ class Language implements ControllerProviderInterface
|
|||||||
$out['sureToRemoveList'] = _('Are you sure you want to delete this list ?');
|
$out['sureToRemoveList'] = _('Are you sure you want to delete this list ?');
|
||||||
$out['newListName'] = _('New list name ?');
|
$out['newListName'] = _('New list name ?');
|
||||||
$out['listNameCannotBeEmpty'] = _('List name can not be empty');
|
$out['listNameCannotBeEmpty'] = _('List name can not be empty');
|
||||||
|
$out['FeedBackName'] = _('Name');
|
||||||
|
$out['FeedBackMessage'] = _('Message');
|
||||||
|
$out['FeedBackNoUsersSelected'] = _('No users selected');
|
||||||
|
|
||||||
$Serializer = $app['Core']['Serializer'];
|
$Serializer = $app['Core']['Serializer'];
|
||||||
|
|
||||||
|
@@ -64,6 +64,7 @@ class Push implements ControllerProviderInterface
|
|||||||
'type' => 'LIST'
|
'type' => 'LIST'
|
||||||
, 'list_id' => $List->getId()
|
, 'list_id' => $List->getId()
|
||||||
, 'name' => $List->getName()
|
, 'name' => $List->getName()
|
||||||
|
, 'length' => count($entries)
|
||||||
, 'entries' => $entries
|
, 'entries' => $entries
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -90,7 +91,7 @@ class Push implements ControllerProviderInterface
|
|||||||
'lists' => $repository->findUserLists($app['Core']->getAuthenticatedUser())
|
'lists' => $repository->findUserLists($app['Core']->getAuthenticatedUser())
|
||||||
);
|
);
|
||||||
|
|
||||||
$template = 'prod/actions/Feedback.html.twig';
|
$template = 'prod/actions/Push.html.twig';
|
||||||
|
|
||||||
/* @var $twig \Twig_Environment */
|
/* @var $twig \Twig_Environment */
|
||||||
$twig = $app['Core']->getTwig();
|
$twig = $app['Core']->getTwig();
|
||||||
@@ -145,7 +146,7 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
$push_description = $request->get('push_description');
|
$push_description = $request->get('push_description');
|
||||||
|
|
||||||
$receivers = $request->get('receivers');
|
$receivers = $request->get('participants');
|
||||||
|
|
||||||
if (!is_array($receivers) || count($receivers) === 0)
|
if (!is_array($receivers) || count($receivers) === 0)
|
||||||
{
|
{
|
||||||
@@ -209,7 +210,7 @@ class Push implements ControllerProviderInterface
|
|||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
_('%1$d records have been sent to %2$d users')
|
_('%1$d records have been sent to %2$d users')
|
||||||
, count($pusher->get_elements())
|
, count($pusher->get_elements())
|
||||||
, count($request->get('receivers'))
|
, count($receivers)
|
||||||
);
|
);
|
||||||
|
|
||||||
$ret = array(
|
$ret = array(
|
||||||
@@ -286,11 +287,11 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
$em->persist($BasketElement);
|
$em->persist($BasketElement);
|
||||||
}
|
}
|
||||||
|
//
|
||||||
$em->flush();
|
// $em->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->refresh($Basket);
|
// $em->refresh($Basket);
|
||||||
|
|
||||||
if (!$Basket->getValidation())
|
if (!$Basket->getValidation())
|
||||||
{
|
{
|
||||||
@@ -309,7 +310,7 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
$appbox = \appbox::get_instance();
|
$appbox = \appbox::get_instance();
|
||||||
|
|
||||||
foreach ($participants as $participant)
|
foreach ($participants as $key=>$participant)
|
||||||
{
|
{
|
||||||
foreach (array('see_others', 'usr_id', 'agree', 'HD') as $mandatoryparam)
|
foreach (array('see_others', 'usr_id', 'agree', 'HD') as $mandatoryparam)
|
||||||
{
|
{
|
||||||
@@ -386,7 +387,7 @@ class Push implements ControllerProviderInterface
|
|||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
_('%1$d records have been sent for validation to %2$d users')
|
_('%1$d records have been sent for validation to %2$d users')
|
||||||
, count($pusher->get_elements())
|
, count($pusher->get_elements())
|
||||||
, count($request->get('$participants'))
|
, count($request->get('participants'))
|
||||||
);
|
);
|
||||||
|
|
||||||
$ret = array(
|
$ret = array(
|
||||||
@@ -597,6 +598,79 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$controllers->match('/edit-list/{list_id}/', function(Application $app, Request $request, $list_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
|
$repository = $em->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
|
$list = $repository->findUserListByUserAndId($user, $list_id);
|
||||||
|
|
||||||
|
$query = new \User_Query(\appbox::get_instance());
|
||||||
|
|
||||||
|
$query->on_bases_where_i_am($user->ACL(), array('canpush'));
|
||||||
|
|
||||||
|
if ($request->get('query'))
|
||||||
|
{
|
||||||
|
$query->like($request->get('like_field'), $request->get('query'))
|
||||||
|
->like_match(\User_Query::LIKE_MATCH_OR);
|
||||||
|
}
|
||||||
|
if (is_array($request->get('Activity')))
|
||||||
|
{
|
||||||
|
$query->haveActivities($request->get('Activity'));
|
||||||
|
}
|
||||||
|
if (is_array($request->get('Template')))
|
||||||
|
{
|
||||||
|
$query->haveTemplate($request->get('Template'));
|
||||||
|
}
|
||||||
|
if (is_array($request->get('Company')))
|
||||||
|
{
|
||||||
|
$query->inCompanies($request->get('Company'));
|
||||||
|
}
|
||||||
|
if (is_array($request->get('Country')))
|
||||||
|
{
|
||||||
|
$query->inCountries($request->get('Country'));
|
||||||
|
}
|
||||||
|
if (is_array($request->get('Position')))
|
||||||
|
{
|
||||||
|
$query->havePositions($request->get('Position'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$sort = $request->get('srt', 'usr_creationdate');
|
||||||
|
$ord = $request->get('ord', 'desc');
|
||||||
|
|
||||||
|
$query->sort_by($sort, $ord);
|
||||||
|
|
||||||
|
$results = $query->include_phantoms()
|
||||||
|
->limit(0, 10)
|
||||||
|
->execute()->get_results();
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
'query' => $query
|
||||||
|
, 'results' => $results
|
||||||
|
, 'list' => $list
|
||||||
|
, 'sort' => $sort
|
||||||
|
, 'ord' => $ord
|
||||||
|
);
|
||||||
|
|
||||||
|
if($request->get('type') === 'fragment')
|
||||||
|
{
|
||||||
|
return new Response(
|
||||||
|
$app['Core']->getTwig()->render('prod/actions/Feedback/ResultTable.html.twig', $params)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Response(
|
||||||
|
$app['Core']->getTwig()->render('prod/actions/Feedback/list.html.twig', $params)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)->assert('list_id', '\d+');
|
||||||
|
|
||||||
return $controllers;
|
return $controllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -198,16 +198,8 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
$controllers->get('/list/{list_id}/', function(Application $app, Request $request, $list_id)
|
$controllers->get('/list/{list_id}/', function(Application $app, Request $request, $list_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
$datas = array(
|
|
||||||
'success' => false
|
|
||||||
, 'message' => ''
|
|
||||||
, 'result' => null
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$user = $app['Core']->getAuthenticatedUser();
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
@@ -254,36 +246,9 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
'users' => $entries
|
'users' => $entries
|
||||||
);
|
);
|
||||||
|
|
||||||
$datas = array(
|
|
||||||
'success' => true
|
|
||||||
, 'message' => ''
|
|
||||||
, 'result' => $result
|
|
||||||
);
|
|
||||||
}
|
|
||||||
catch (ControllerException $e)
|
|
||||||
{
|
|
||||||
$datas = array(
|
|
||||||
'success' => false
|
|
||||||
, 'message' => $e->getMessage()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->getRequestFormat() == 'json')
|
|
||||||
{
|
|
||||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
|
||||||
|
|
||||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
return new Response($app['Core']->getTwig()->render('prod/actions/Feedback/list.html.twig', $result));
|
return new Response($app['Core']->getTwig()->render('prod/actions/Feedback/list.html.twig', $result));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -107,7 +107,7 @@ class WorkZone implements ControllerProviderInterface
|
|||||||
return new Response($app['Core']->getTwig()->render('prod/WorkZone/Browser/Results.html.twig', $params));
|
return new Response($app['Core']->getTwig()->render('prod/WorkZone/Browser/Results.html.twig', $params));
|
||||||
});
|
});
|
||||||
|
|
||||||
$controllers->get('/Browse/Basket/{basket_id}/', function(Application $app, $basket_id)
|
$controllers->get('/Browse/Basket/{basket_id}/', function(Application $app, Request $request, $basket_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
|
Reference in New Issue
Block a user