first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,673 @@
<?php
/**
* SOTESHOP/stUser
*
* Ten plik należy do aplikacji stUser opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stUser
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: actions.class.php 617 2009-04-09 13:02:31Z michal $
* @author Marcin Butlak <marcin.butlak@sote.pl>
*/
/**
* Klasa stUserActions
*
* @package stUser
* @subpackage actions
*/
class stUserActions extends autostUserActions {
protected function addUserDataBillingFiltersCriteria($c)
{
$c->add(UserDataPeer::IS_BILLING, true);
return parent::addUserDataBillingFiltersCriteria($c);
}
protected function addUserDataDeliveryFiltersCriteria($c)
{
$c->add(UserDataPeer::IS_BILLING, false);
return parent::addUserDataDeliveryFiltersCriteria($c);
}
/**
* Przeciążenie zapisu sfGuardUser
*
* @param sfGuardUser $sf_guard_user
*/
protected function savesfGuardUser($sf_guard_user) {
$c = new Criteria();
$c -> add(MailDescriptionPeer::SYSTEM_NAME, "admin_confirm_user");
$mail_description = MailDescriptionPeer::doSelectOne($c);
$mail_description_active = $mail_description -> getIsActive();
$culture = $this -> getUser() -> getCulture();
if ($sf_guard_user -> getLanguage()) {
$this -> getUser() -> setCulture($sf_guard_user -> getLanguage());
}
if (!$sf_guard_user -> getId()) {
$sf_guard_user -> addGroupByName('user');
$sf_guard_user -> setHashCode(md5(microtime()));
if ($sf_guard_user -> getIsAdminConfirm() == 1 && $mail_description_active == 1) {
$this -> mailWithNewUserToUser($sf_guard_user);
}
}
if ($sf_guard_user -> getId()) {
$c = new Criteria();
$c -> add(sfGuardUserPeer::ID, $sf_guard_user -> getId());
$user = sfGuardUserPeer::doSelectOne($c);
$isAdminConfirm = $user -> getIsAdminConfirm();
}
if ($sf_guard_user -> getIsAdminConfirm() == 1 && $isAdminConfirm == 0 && $mail_description_active == 1) {
$this -> mailWithNewUserToUser($sf_guard_user);
}
$this -> getUser() -> setCulture($culture);
parent::savesfGuardUser($sf_guard_user);
}
/**
* Wysyła mail z zamówieniem do administratora
*/
function mailWithNewUserToUser($user) {
$mail_config = stConfig::getInstance($this->getContext(), 'stMailAccountBackend');
$mailHtmlHead = stMailer::getHtmlMailDescription("header");
$mailHtmlFoot = stMailer::getHtmlMailDescription("footer");
$mailHtmlContent = stMailer::getHtmlMailDescription("admin_confirm_user");
$sendAdminConfirmHtmlMailMessage = stMailTemplate::render('sendAdminConfirmHtml', array('user' => $user, 'head' => $mailHtmlHead, 'foot' => $mailHtmlFoot, 'content' => $mailHtmlContent, 'mail_config'=>$mail_config));
$mailPlainHead = stMailer::getPlainMailDescription("header");
$mailPlainFoot = stMailer::getPlainMailDescription("footer");
$mailPlainContent = stMailer::getPlainMailDescription("admin_confirm_user");
$sendAdminConfirmPlainMailMessage = stMailTemplate::render('sendAdminConfirmPlain', array('user' => $user, 'head' => $mailPlainHead, 'foot' => $mailPlainFoot, 'content' => $mailPlainContent, ));
$mail = stMailer::getInstance();
return $mail -> setSubject(__('Twoje konto w sklepie zostało zweryfikowane.')) -> setHtmlMessage($sendAdminConfirmHtmlMailMessage) -> setPlainMessage($sendAdminConfirmPlainMailMessage) -> setTo($user -> getUsername()) -> sendToClient();
}
protected function saveUserDataBillingUserData($user_data) {
$user_data->setIsBilling(true);
return parent::saveUserDataBillingUserData($user_data);
}
protected function saveUserDataDeliveryUserData($user_data) {
$user_data->setIsBilling(false);
return parent::saveUserDataDeliveryUserData($user_data);
}
public function executeUpdateConfirm() {
$user_id = $this -> getRequestParameter('id');
$c = new Criteria();
$c -> add(sfGuardUserPeer::ID, $user_id);
$user = sfGuardUserPeer::doSelectOne($c);
$user -> setIsConfirm(1);
$user -> save();
return $this -> redirect('stUser/edit?id=' . $user -> getId());
}
public function executeUpdateAdminConfirm() {
$user_id = $this -> getRequestParameter('id');
$c = new Criteria();
$c -> add(sfGuardUserPeer::ID, $user_id);
$user = sfGuardUserPeer::doSelectOne($c);
$user -> setIsAdminConfirm(1);
$user -> save();
return $this -> redirect('stUser/edit?id=' . $user -> getId());
}
protected function addJoinUserDataCriteria(Criteria $c)
{
if (!array_key_exists(sfGuardUserPeer::ID.UserDataPeer::SF_GUARD_USER_ID, $c->getJoins()))
{
$c -> addJoin(sfGuardUserPeer::ID, UserDataPeer::SF_GUARD_USER_ID, Criteria::LEFT_JOIN);
if (!in_array(sfGuardUserPeer::ID, $c->getGroupByColumns()))
{
$c->addGroupByColumn(sfGuardUserPeer::ID);
}
}
}
protected function addSortCriteria($c) {
parent::addSortCriteria($c);
$sort = $this->getUser()->getAttribute('sort', null, 'sf_admin/autoStUser/sort');
if ($sort == 'full_name' || $sort == 'company') {
$this->addJoinUserDataCriteria($c);
}
}
protected function addFiltersCriteria($c) {
parent::addFiltersCriteria($c);
$group = sfGuardGroupPeer::retrieveByName('user');
$c->addJoin(sfGuardUserPeer::ID, sfGuardUserGroupPeer::USER_ID);
$c->add(sfGuardUserGroupPeer::GROUP_ID, $group->getId());
if (isset($this -> filters['filter_full_name']) && !empty($this -> filters['filter_full_name'])) {
$this->addJoinUserDataCriteria($c);
$c -> add(UserDataPeer::IS_BILLING, 1);
$c -> add(UserDataPeer::FULL_NAME, '%'.$this -> filters['filter_full_name'].'%', Criteria::LIKE);
}
if (isset($this -> filters['filter_company']) && !empty($this -> filters['filter_company'])) {
$this->addJoinUserDataCriteria($c);
$c -> add(UserDataPeer::IS_BILLING, 1);
$c -> add(UserDataPeer::COMPANY, '%'.$this -> filters['filter_company'].'%', Criteria::LIKE);
}
if (isset($this->filters['is_admin_confirm']) && !empty($this->filters['is_admin_confirm']))
{
$c->add(sfGuardUserPeer::IS_ADMIN_CONFIRM, $this->filters['is_admin_confirm']);
}
}
public function executeRegisterUserWidget() {
$this -> setLayout('layout_gadget');
$backendMainConfig = stConfig::getInstance($this -> getContext(), 'stBackendMain');
if ($this -> getRequestParameter('date_type')) {
$date_type = $this -> getRequestParameter('date_type');
$backendMainConfig -> set('date_type', $date_type);
$backendMainConfig -> save();
} else {
$date_type = $backendMainConfig -> get('date_type');
}
if ($date_type == "day") {
$from_date = date('Y-m-d H:i:s', time() - 86400);
} elseif ($date_type == "week") {
$from_date = date('Y-m-d H:i:s', time() - 604800);
} elseif ($date_type == "month") {
$from_date = date('Y-m-d H:i:s', time() - 2419200);
} elseif ($date_type == "lastlog") {
$c = new Criteria();
$c -> add(sfGuardUserPeer::ID, $this -> getUser() -> getAttribute('user_id', null, 'sfGuardSecurityUser'));
$user = sfGuardUserPeer::doSelectOne($c);
$from_date = $this -> getUser() -> getLastLogin();
}
$to_date = date('Y-m-d H:i:s');
$this -> date_type = $date_type;
$this -> from_date = $from_date;
$this -> to_date = $to_date;
//klienci
$c = new Criteria();
$criterion = $c -> getNewCriterion(sfGuardUserPeer::CREATED_AT, $from_date, Criteria::GREATER_EQUAL);
$criterion -> addAnd($c -> getNewCriterion(sfGuardUserPeer::CREATED_AT, $to_date, Criteria::LESS_EQUAL));
$c -> add($criterion);
$c -> addDescendingOrderByColumn(SfGuardUserPeer::CREATED_AT);
$c -> addJoin(sfGuardUserPeer::ID, sfGuardUserGroupPeer::USER_ID);
$c -> addJoin(sfGuardUserGroupPeer::GROUP_ID, sfGuardGroupPermissionPeer::GROUP_ID);
$c -> addJoin(sfGuardPermissionPeer::ID, sfGuardGroupPermissionPeer::PERMISSION_ID);
$c -> add(sfGuardPermissionPeer::NAME, 'user');
$c -> setLimit(100);
$users = SfGuardUserPeer::doSelect($c);
if (SfGuardUserPeer::doSelect($c)) {
$i = 0;
foreach ($users as $user) {
$c = new Criteria();
$c -> add(UserDataPeer::SF_GUARD_USER_ID, $user -> getId());
$c -> add(UserDataPeer::IS_DEFAULT, 1);
$c -> add(UserDataPeer::IS_BILLING, 1);
$userDataBilling = UserDataPeer::doSelectOne($c);
$userInfo[$i]['username'] = $user -> getUsername();
$userInfo[$i]['id'] = $user -> getId();
if ($userDataBilling) {
$userInfo[$i]['fullname'] = $userDataBilling -> getFullName();
$userInfo[$i]['company'] = $userDataBilling -> getCompany();
}
$userInfo[$i]['created_at'] = $user -> getCreatedAt();
$i++;
}
$this -> userInfo = $userInfo;
$this -> userQuantity = count($users);
} else {
$this -> userInfo = "";
$this -> userQuantity = 0;
}
}
public function validateEdit() {
$ok = true;
if ($this -> getRequest() -> getMethod() == sfRequest::POST) {
if (!$this -> getRequest() -> getParameter('id')) {
$i18n = $this -> getContext() -> getI18N();
if ($this -> getRequestParameter('sf_guard_user[password]') !=$this -> getRequestParameter('sf_guard_user[password_bis]')) {
$this -> getRequest() -> setError('sf_guard_user{password}', $i18n -> __('Hasła nie są takie same.'));
$this -> getRequest() -> setError('sf_guard_user{password_bis}', $i18n -> __('Hasła nie są takie same.'));
$ok = false;
}
if (strlen($this -> getRequestParameter('sf_guard_user[password]'))<6) {
$this -> getRequest() -> setError('sf_guard_user{password}', $i18n -> __('Za krótkie hasło min. 6 znaków.'));
$ok = false;
}
if (strlen($this -> getRequestParameter('sf_guard_user[password_bis]'))<6) {
$this -> getRequest() -> setError('sf_guard_user{password_bis}', $i18n -> __('Za krótkie hasło min. 6 znaków.'));
$ok = false;
}
if (!$this -> getRequestParameter('sf_guard_user[password]')) {
$this -> getRequest() -> setError('sf_guard_user{password}', $i18n -> __('Proszę podać hasło.'));
$ok = false;
}
if (!$this -> getRequestParameter('sf_guard_user[password_bis]')) {
$this -> getRequest() -> setError('sf_guard_user{password_bis}', $i18n -> __('Proszę podać hasło.'));
$ok = false;
}
}
if ($this -> getRequest() -> getParameter('id')) {
$i18n = $this -> getContext() -> getI18N();
if ($this -> getRequestParameter('sf_guard_user[password]') || $this -> getRequestParameter('sf_guard_user[password_bis]')) {
if ($this -> getRequestParameter('sf_guard_user[password]') !=$this -> getRequestParameter('sf_guard_user[password_bis]')) {
$this -> getRequest() -> setError('sf_guard_user{password}', $i18n -> __('Hasła nie są takie same.'));
$this -> getRequest() -> setError('sf_guard_user{password_bis}', $i18n -> __('Hasła nie są takie same.'));
$ok = false;
}
if (strlen($this -> getRequestParameter('sf_guard_user[password]'))<6) {
$this -> getRequest() -> setError('sf_guard_user{password}', $i18n -> __('Za krótkie hasło min. 6 znaków.'));
$ok = false;
}
if (strlen($this -> getRequestParameter('sf_guard_user[password_bis]'))<6) {
$this -> getRequest() -> setError('sf_guard_user{password_bis}', $i18n -> __('Za krótkie hasło min. 6 znaków.'));
$ok = false;
}
if (!$this -> getRequestParameter('sf_guard_user[password]')) {
$this -> getRequest() -> setError('sf_guard_user{password}', $i18n -> __('Proszę podać hasło.'));
$ok = false;
}
if (!$this -> getRequestParameter('sf_guard_user[password_bis]')) {
$this -> getRequest() -> setError('sf_guard_user{password_bis}', $i18n -> __('Proszę podać hasło.'));
$ok = false;
}
}
}
}
return $ok;
}
public function validatePointsEdit() {
$ok = true;
if ($this -> getRequest() -> getMethod() == sfRequest::POST) {
$i18n = $this -> getContext() -> getI18N();
$points = $this -> getRequestParameter('sf_guard_user[points]');
if ($points=="" || $points < 0 ) {
$this -> getRequest() -> setError('sf_guard_user{points}', $i18n -> __('Proszę podać punkty.'));
$ok = false;
} else {
$pattern = "/^[0-9]+$/";
if (preg_match($pattern, $points) != 1) {
$this -> getRequest() -> setError('sf_guard_user{points}', $i18n -> __('Niepoprawna wartość'));
$ok = false;
}
}
}
return $ok;
}
protected function savePointssfGuardUser($sf_guard_user) {
$this -> getDispatcher() -> notify(new sfEvent($this, 'autoStUserActions.preSavePoints', array('modelInstance' => $sf_guard_user)));
$sf_guard_user -> save();
$i18n = $this->getContext()->getI18n();
$c = new Criteria();
$c -> add(UserPointsPeer::SF_GUARD_USER_ID, $sf_guard_user -> getId());
$c -> addDescendingOrderByColumn(UserPointsPeer::CREATED_AT);
$lastPoints = UserPointsPeer::doSelectOne($c);
if ($lastPoints) {
if ($sf_guard_user -> getPoints() != $lastPoints -> getPoints()) {
if ($lastPoints -> getPoints() > $sf_guard_user -> getPoints()) {
$points = $lastPoints -> getPoints() - $sf_guard_user -> getPoints();
$change_points = "-" . $points;
} else {
$points = $sf_guard_user -> getPoints() - $lastPoints -> getPoints();
$change_points = "+" . $points;
}
$userPoints = new UserPoints();
$userPoints -> setSfGuardUserId($sf_guard_user -> getId());
$userPoints -> setAdminId(sfContext::getInstance() -> getUser() -> getGuardUser() -> getId());
$userPoints -> setPoints($sf_guard_user -> getPoints());
$userPoints -> setChangePoints($sf_guard_user -> getPoints() - $lastPoints -> getPoints());
$userPoints -> setChangePointsVarchar($change_points);
if ($this -> getRequestParameter('sf_guard_user[operation_description]') == "") {
$userPoints -> setDescription("Aktualizacja stanu konta");
} else {
$userPoints -> setDescription($this -> getRequestParameter('sf_guard_user[operation_description]'));
}
$userPoints -> save();
}
} else {
$change_points = "+" . $sf_guard_user -> getPoints();
$userPoints = new UserPoints();
$userPoints -> setSfGuardUserId($sf_guard_user -> getId());
$userPoints -> setAdminId(sfContext::getInstance() -> getUser() -> getGuardUser() -> getId());
$userPoints -> setPoints($sf_guard_user -> getPoints());
$userPoints -> setChangePoints($sf_guard_user -> getPoints());
$userPoints -> setChangePointsVarchar($change_points);
if ($this -> getRequestParameter('sf_guard_user[operation_description]') == "") {
$userPoints -> setDescription("Aktualizacja stanu konta");
} else {
$userPoints -> setDescription($this -> getRequestParameter('sf_guard_user[operation_description]'));
}
$userPoints -> save();
}
$this -> getDispatcher() -> notify(new sfEvent($this, 'autoStUserActions.postSavePoints', array('modelInstance' => $sf_guard_user)));
}
public function executeUserPointsList() {
parent::executeUserPointsList();
$this -> pager -> getCriteria() -> add(UserPointsPeer::SF_GUARD_USER_ID, $this -> forward_parameters['user_id']);
$this -> pager -> init();
}
public function validatePointsInfoEdit() {
$ok = true;
if ($this -> getRequest() -> getMethod() == sfRequest::POST) {
$i18n = $this -> getContext() -> getI18N();
$amount = $this -> getRequestParameter('sf_guard_user[user_points]');
if (!$amount) {
$this -> getRequest() -> setError('sf_guard_user{user_points_input_operation}', $i18n -> __('Proszę podać punkty.'));
$ok = false;
} else {
if($amount{0}=="+" || $amount{0}=="-"){
$amount_value = substr($amount, 1);
} else{
$amount_value = $amount;
}
// echo $amount_value;
// die();
//
$pattern = "/^[0-9]+$/";
if (preg_match($pattern, $amount_value) != 1) {
$this -> getRequest() -> setError('sf_guard_user{user_points_input_operation}', $i18n -> __('Niepoprawna wartość'));
$ok = false;
}
$c = new Criteria();
$c -> add(sfGuardUserPeer::ID, $this -> getRequestParameter('id'));
$user = sfGuardUserPeer::doSelectOne($c);
$value = $user->getPoints()+$amount;
if($value<0){
$this -> getRequest() -> setError('sf_guard_user{user_points_input_operation}', $i18n -> __('Odejmowana wartość nie może być większa od aktualnej liczby punktów'));
$ok = false;
}
}
}
return $ok;
}
protected function updatePointsInfosfGuardUserFromRequest() {
$sf_guard_user = $this -> getRequestParameter('sf_guard_user');
if (isset($sf_guard_user['header_user_info'])) {
if (method_exists($this -> sf_guard_user, 'setHeaderUserInfo')) {
$this -> sf_guard_user -> setHeaderUserInfo($sf_guard_user['header_user_info']);
}
}
if (isset($sf_guard_user['header_user_points'])) {
if (method_exists($this -> sf_guard_user, 'setHeaderUserPoints')) {
$this -> sf_guard_user -> setHeaderUserPoints($sf_guard_user['header_user_points']);
}
}
if (isset($sf_guard_user['user_points'])) {
if (method_exists($this -> sf_guard_user, 'setPoints')) {
$new_points = $this -> getRequestParameter('sf_guard_user[user_points]');
$points_value = substr($new_points, 1);
if ($new_points{0} == "-") {
$new_user_points = $this -> sf_guard_user -> getPoints() - $points_value;
}
if ($new_points{0} == "+") {
$new_user_points = $this -> sf_guard_user -> getPoints() + $points_value;
}
if ($new_points{0} != "+" && $new_points{0} != "-") {
$new_user_points = $this -> sf_guard_user -> getPoints() + $new_points;
}
$this -> sf_guard_user -> setPoints($new_user_points);
}
}
if (isset($sf_guard_user['user_points_input_operation'])) {
if (method_exists($this -> sf_guard_user, 'setUserPointsInputOperation')) {
$this -> sf_guard_user -> setUserPointsInputOperation($sf_guard_user['user_points_input_operation']);
}
}
if (isset($sf_guard_user['user_points_description_operation'])) {
if (method_exists($this -> sf_guard_user, 'setUserPointsDescriptionOperation')) {
$this -> sf_guard_user -> setUserPointsDescriptionOperation($sf_guard_user['user_points_description_operation']);
}
}
$this -> getDispatcher() -> notify(new sfEvent($this, 'autoStUserActions.postUpdatePointsInfoFromRequest', array('modelInstance' => $this -> sf_guard_user, 'requestParameters' => $sf_guard_user)));
}
protected function savePointsInfosfGuardUser($sf_guard_user) {
$this -> getDispatcher() -> notify(new sfEvent($this, 'autoStUserActions.preSavePointsInfo', array('modelInstance' => $sf_guard_user)));
$sf_guard_user -> save();
$i18n = $this->getContext()->getI18n();
$c = new Criteria();
$c -> add(UserPointsPeer::SF_GUARD_USER_ID, $sf_guard_user -> getId());
$c -> addDescendingOrderByColumn(UserPointsPeer::CREATED_AT);
$lastPoints = UserPointsPeer::doSelectOne($c);
if ($lastPoints) {
if ($sf_guard_user -> getPoints() != $lastPoints -> getPoints()) {
if ($lastPoints -> getPoints() > $sf_guard_user -> getPoints()) {
$points = $lastPoints -> getPoints() - $sf_guard_user -> getPoints();
$change_points = "-" . $points;
} else {
$points = $sf_guard_user -> getPoints() - $lastPoints -> getPoints();
$change_points = "+" . $points;
}
$userPoints = new UserPoints();
$userPoints -> setSfGuardUserId($sf_guard_user -> getId());
$userPoints -> setAdminId(sfContext::getInstance() -> getUser() -> getGuardUser() -> getId());
$userPoints -> setPoints($sf_guard_user -> getPoints());
$userPoints -> setChangePoints($sf_guard_user -> getPoints() - $lastPoints -> getPoints());
$userPoints -> setChangePointsVarchar($change_points);
if ($this -> getRequestParameter('sf_guard_user[operation_description]') == "") {
$userPoints -> setDescription("Aktualizacja stanu konta");
} else {
$userPoints -> setDescription($this -> getRequestParameter('sf_guard_user[operation_description]'));
}
$userPoints -> save();
}
} else {
$change_points = "+" . $sf_guard_user -> getPoints();
$userPoints = new UserPoints();
$userPoints -> setSfGuardUserId($sf_guard_user -> getId());
$userPoints -> setAdminId(sfContext::getInstance() -> getUser() -> getGuardUser() -> getId());
$userPoints -> setPoints($sf_guard_user -> getPoints());
$userPoints -> setChangePoints($sf_guard_user -> getPoints());
$userPoints -> setChangePointsVarchar($change_points);
if ($this -> getRequestParameter('sf_guard_user[operation_description]') == "") {
$userPoints -> setDescription("Aktualizacja stanu konta");
} else {
$userPoints -> setDescription($this -> getRequestParameter('sf_guard_user[operation_description]'));
}
$userPoints -> save();
}
$this -> getDispatcher() -> notify(new sfEvent($this, 'autoStUserActions.postSavePointsInfo', array('modelInstance' => $sf_guard_user)));
}
public function executePointsAvailable() {
$user_id = $this -> getRequestParameter('user_id');
$on = $this -> getRequestParameter('on');
$c = new Criteria();
$c -> add(sfGuardUserPeer::ID, $user_id);
$user = sfGuardUserPeer::doSelectOne($c);
$user -> setPointsAvailable($on);
$user -> save();
return $this -> redirect('stUser/pointsInfoEdit?id='.$user->getId());
}
public function executePointsRelease() {
$user_id = $this -> getRequestParameter('user_id');
$on = $this -> getRequestParameter('on');
$c = new Criteria();
$c -> add(sfGuardUserPeer::ID, $user_id);
$user = sfGuardUserPeer::doSelectOne($c);
$user -> setPointsRelease($on);
$user -> save();
return $this -> redirect('stUser/pointsInfoEdit?id='.$user->getId());
}
protected function getsfGuardUserOrCreate($id = 'id')
{
$user = parent::getsfGuardUserOrCreate($id);
if ($user->isNew())
{
$this->hideField('dane_bilingowe');
$this->hideField('dane_dostawy');
}
return $user;
}
protected function getUserDataBillingUserDataOrCreate($id = 'id')
{
$userData = parent::getUserDataBillingUserDataOrCreate($id);
$country = CountriesPeer::retrieveByIsoA2('PL');
$userData->setCountries($country);
return $userData;
}
protected function getUserDataDeliveryUserDataOrCreate($id = 'id')
{
$userData = parent::getUserDataDeliveryUserDataOrCreate($id);
$country = CountriesPeer::retrieveByIsoA2('PL');
$userData->setCountries($country);
return $userData;
}
}

View File

@@ -0,0 +1,267 @@
<?php
/**
* SOTESHOP/stUser
*
* Ten plik należy do aplikacji stUser opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stUser
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: components.class.php 617 2009-04-09 13:02:31Z michal $
* @author Marcin Butlak <marcin.butlak@sote.pl>
*/
/**
* Klasa stUserComponents
*
* @package stUser
* @subpackage actions
*/
class stUserComponents extends autostUserComponents
{
public function executeClientUsername()
{
$c = new Criteria();
$c->add(sfGuardUserPeer::ID, $this->forward_parameters['user_id']);
$sf_guard_user = sfGuardUserPeer::doSelectOne($c);
$this->username = $sf_guard_user->getUsername();
}
public function executeUsername()
{
$this->username = $this->sf_guard_user->getUsername();
$this->id = $this->sf_guard_user->getId();
}
public function executeFullName()
{
$c = new Criteria();
$c->add(UserDataPeer::SF_GUARD_USER_ID, $this->sf_guard_user->getId());
$c->add(UserDataPeer::IS_DEFAULT, 1);
$c->add(UserDataPeer::IS_BILLING, 1);
if ($userDataBillingDefault = UserDataPeer::doSelectOne($c))
{
$this->full_name = $userDataBillingDefault->getFullName();
}
else
{
$this->full_name = "-";
}
$this->id = $this->sf_guard_user->getId();
}
public function executeCompany()
{
$c = new Criteria();
$c->add(UserDataPeer::SF_GUARD_USER_ID, $this->sf_guard_user->getId());
$c->add(UserDataPeer::IS_DEFAULT, 1);
$c->add(UserDataPeer::IS_BILLING, 1);
if ($userDataBillingDefault = UserDataPeer::doSelectOne($c))
{
$this->company = $userDataBillingDefault->getCompany();
}
else
{
$this->company = "-";
}
$this->id = $this->sf_guard_user->getId();
}
public function executePassword()
{
}
public function executePasswordBis()
{
}
public function executeIsDefault()
{
}
public function executeUserInfo()
{
$this->user_data_billing = $this->getUserDataBillingDefault($this->getRequestParameter('id'));
$this->user_data_delivery = $this->getUserDataDeliveryDefault($this->getRequestParameter('id'));
$this->id = $this->getRequestParameter('id');
}
public function getUserDataBillingDefault($user_id)
{
$c = new Criteria();
$c->add(UserDataPeer::SF_GUARD_USER_ID, $user_id);
$c->add(UserDataPeer::IS_DEFAULT, 1);
$c->add(UserDataPeer::IS_BILLING, 1);
if ($userDataBillingDefault = UserDataPeer::doSelectOne($c))
{
$this->user_data = $userDataBillingDefault;
}
else
{
$this->user_data = new UserData();
$this->user_data->setSfGuardUserId($user_id);
$this->user_data->setIsBilling(1);
$this->user_data->setIsDefault(1);
$this->user_data->setCountriesId(36);
}
$userDataBillingDefault = $this->user_data;
return $userDataBillingDefault;
}
public function getUserDataDeliveryDefault($user_id)
{
$c = new Criteria();
$c->add(UserDataPeer::SF_GUARD_USER_ID, $user_id);
$c->add(UserDataPeer::IS_DEFAULT, 1);
$c->add(UserDataPeer::IS_BILLING, 0);
if ($userDataDeliveryDefault = UserDataPeer::doSelectOne($c))
{
$this->user_data = $userDataDeliveryDefault;
}
else
{
$this->user_data = new UserData();
$this->user_data->setSfGuardUserId($user_id);
$this->user_data->setIsBilling(0);
$this->user_data->setIsDefault(1);
$this->user_data->setCountriesId(36);
}
$userDataDeliveryDefault = $this->user_data;
return $userDataDeliveryDefault;
}
public function executeUserConfirm()
{
$this->confirm = $this->sf_guard_user->getIsConfirm();
$this->id = $this->sf_guard_user->getId();
}
public function executeUserAdminConfirm()
{
$this->admin_confirm = $this->sf_guard_user->getIsAdminConfirm();
$this->id = $this->sf_guard_user->getId();
}
public function executeUserOrder()
{
$this->username = $this->sf_guard_user->getUsername();
}
public function executeHeaderUserPointsAvaible()
{
$this->id = $this->getRequestParameter('id');
$config_points = stConfig::getInstance('stPointsBackend');
$config_points->setCulture(sfContext::getInstance()->getUser()->getCulture());
$this->points_shortcut = $config_points->get('points_shortcut', null, true);
$c = new Criteria();
$c->add(sfGuardUserPeer::ID, $this->getRequestParameter('id'));
$user = sfGuardUserPeer::doSelectOne($c);
$this->user = $user;
}
public function executeHeaderUserPointsRelease()
{
$this->id = $this->getRequestParameter('id');
$config_points = stConfig::getInstance('stPointsBackend');
$config_points->setCulture(sfContext::getInstance()->getUser()->getCulture());
$this->points_shortcut = $config_points->get('points_shortcut', null, true);
$c = new Criteria();
$c->add(sfGuardUserPeer::ID, $this->getRequestParameter('id'));
$user = sfGuardUserPeer::doSelectOne($c);
if ($user->getPointsRelease() != 1 && $user->getPoints() >= $config_points->get('points_release_value'))
{
$user->setPointsRelease(1);
$user->save();
}
$this->user = $user;
}
public function executeHeaderUserInfo()
{
$this->id = $this->getRequestParameter('id');
$c = new Criteria();
$c->add(sfGuardUserPeer::ID, $this->getRequestParameter('id'));
$user = sfGuardUserPeer::doSelectOne($c);
$this->user = $user;
}
public function executeHeaderUserPoints()
{
$this->id = $this->getRequestParameter('id');
$c = new Criteria();
$c->add(sfGuardUserPeer::ID, $this->getRequestParameter('id'));
$user = sfGuardUserPeer::doSelectOne($c);
$this->user = $user;
$config_points = stConfig::getInstance('stPointsBackend');
$config_points->setCulture(sfContext::getInstance()->getUser()->getCulture());
$this->points_shortcut = $config_points->get('points_shortcut', null, true);
}
public function executeUserPoints()
{
$this->id = $this->getRequestParameter('id');
// $c = new Criteria();
// $c -> add(UserPointsPeer::SF_GUARD_USER_ID, $this -> getRequestParameter('id'));
// $c -> addDescendingOrderByColumn(UserPointsPeer::CREATED_AT);
// $transactions = UserPointsPeer::doSelect($c);
$c = new Criteria();
$c->add(UserPointsPeer::SF_GUARD_USER_ID, $this->getRequestParameter('id'));
//$c->addJoin(UserPointsPeer::ADMIN_ID, SfGuardUserPeer::ID);
$c->addDescendingOrderByColumn(UserPointsPeer::CREATED_AT);
$transactions = UserPointsPeer::doSelectJoinSfGuardUserRelatedByAdminId($c);
// echo "<pre>";
// print_r($transactions);
$this->transactions = $transactions;
$c = new Criteria();
$c->add(sfGuardUserPeer::ID, $this->getRequestParameter('id'));
$user = sfGuardUserPeer::doSelectOne($c);
$this->user = $user;
}
public function executeOperationDescription()
{
$this->description = $this->getRequestParameter('sf_guard_user[operation_description]');
}
public function executeUserPointsInputOperation()
{
$this->points = $this->getRequestParameter('sf_guard_user[user_points]');
}
public function executeUserPointsDescriptionOperation()
{
$this->description = $this->getRequestParameter('sf_guard_user[operation_description]');
}
}

View File

@@ -0,0 +1,23 @@
<?php
/**
* SOTESHOP/stUser
*
* Ten plik należy do aplikacji stUser opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stUser
* @subpackage configs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: config.php 1307 2009-05-20 12:52:02Z bartek $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Dodanie routingu
*/
stPluginHelper::addRouting('stUser','/user/:action/*','stUser','list','backend');
stPluginHelper::addRouting('stRegisterUserWidget', '/user/registerUserWidget', 'stUser', 'registerUserWidget', 'backend');

View File

@@ -0,0 +1,269 @@
generator:
class: stAdminGenerator
param:
model_class: sfGuardUser
points_model_class: sfGuardUser
points_info_model_class: sfGuardUser
user_points_model_class: UserPoints
user_data_billing_model_class: UserData
user_data_delivery_model_class: UserData
theme: simple
head:
package: stUser
applications: [stOrder, stPayment, stInvoicePlugin, stPointsPlugin]
custom_actions:
list: [user_data_billing, user_data_delivery, user_points]
edit: [user_data_billing, user_data_delivery, points, points_info]
documentation:
pl: https://www.sote.pl/docs/klienci-sklep-internetowy
en: https://www.soteshop.com/docs/users
list:
title: Klienci sklepu
display: [created_at, ~username, ~full_name, ~company, _wholesale_list, general_discount_value, is_admin_confirm, is_confirm]
hideable: [wholesale_list, created_at, is_admin_confirm, is_confirm, general_discount_value]
fields:
username: {name: Login (E-mail), params: truncate_text=true truncate_text_lines=1, width: 30%}
full_name: {name: Imię i nazwisko}
company: {name: Firma, params: truncate_text=true}
wholesale_list: {name: Hurtownik - grupa, sort_field: sf_guard_user.wholesale, align: center, filterable: false, width: 1%}
created_at: {name: Dodany, filterable: false, width: 1%}
general_discount_value: {name: Rabat ogólny, align: right, width: 1%, custom_value: "%%general_discount_value%%%"}
is_admin_confirm: {name: Zweryfikowany, width: 1%}
is_confirm: {name: Potwierdzony, width: 1%}
menu:
display: [_list]
fields:
_list: {name: Klienci sklepu, action: stUser/list}
config: {name: Konfiguracja, action: stUser/config}
filters:
full_name: {partial: filter_full_name}
company: {partial: filter_company}
wholesale_list: {filter_field: sf_guard_user.wholesale, partial: filter_wholesale}
is_admin_confirm: {partial: filter_is_admin_confirm}
additional_filters: [wholesale_list, created_at]
sort: [created_at, desc]
actions:
_create: {name: Dodaj}
object_actions:
_edit: -
_delete: -
config:
title: Konfiguracja
menu: {use: list.menu}
description: Klienci sklepu
hide_install_version:
"Google": 6.7.9
display:
"NONE": [show_users_online, show_address_more, show_region, show_pesel, change_default_user, validate_phone]
"Google": [google_auth_on, google_client_id, google_secret_id, google_developer_key]
fields:
show_users_online: {name: Pokaż użytkowników on-line, type: checkbox, old_config: true }
show_region: {name: Pokaż województwo, type: checkbox}
show_pesel: {name: Pokaż PESEL, type: checkbox}
show_address_more: {name: Pokaż dodatkową linię adresu, type: checkbox}
change_default_user: {name: Domyślnie klient to firma, type: checkbox}
validate_phone: {name: Wymagaj numeru telefonu, help: "Podczas składania zamówienia i rejestracji nowego użytkownika", type: checkbox}
google_auth_on: {name: Włącz możliwość logowania przez google, type: checkbox}
google_client_id: {name: Google client ID}
google_secret_id: {name: Google secret}
google_developer_key: {name: Google developer key}
actions:
_save: {name: Zapisz}
user_data_billing_list:
title: Dane billingowe
menu: {use: edit.menu}
forward_parameters: [user_id]
build_options:
related_id: forward_parameters.user_id
related_field: sf_guard_user_id
related_class: sfGuardUser
display: [=full_name, company, is_default]
fields:
full_name: {name: Imię i nazwisko, params: truncate_text=100}
company: {name: Firma, params: truncate_text=100}
is_default: {name: Domyślny}
actions:
_create: {name: Dodaj nowe dane billingowe, i18n: stUser}
object_actions:
_edit: -
_delete: -
user_data_billing_edit:
title: Dane billingowe
menu: {use: edit.menu}
forward_parameters: [user_id]
build_options:
related_id: forward_parameters.user_id
related_field: sf_guard_user_id
related_class: sfGuardUser
display: [~is_default, company, full_name, address, address_more, region, code, town, countries_id, phone, vat_number, pesel]
fields:
is_default: {name: Domyślny}
company: {name: Firma}
full_name: {name: Imię i nazwisko}
address: {name: Adres, required: true}
address_more: {name: Adres cd}
region: {name: Województwo}
code: {name: Kod, required: true}
town: {name: Miasto, required: true}
countries_id: {name: Kraj, params: "peer_method=doSelectActive"}
phone: {name: Telefon, required: true}
vat_number: {name: NIP}
pesel: {name: PESEL}
actions:
_list: {name: Pokaż listę}
_save: {name: Zapisz}
user_data_delivery_list:
title: Dane dostawy
menu: {use: edit.menu}
forward_parameters: [user_id]
build_options:
related_id: forward_parameters.user_id
related_field: sf_guard_user_id
related_class: sfGuardUser
display: [=full_name, company, is_default]
fields:
full_name: {name: Imię i nazwisko, params: truncate_text=100}
company: {name: Firma, params: truncate_text=100}
is_default: {name: Domyślny}
actions:
_create: {name: Dodaj nowe dane dostawy, i18n: stUser}
object_actions:
_edit: -
_delete: -
user_data_delivery_edit:
title: Dane dostawy
menu: {use: edit.menu}
forward_parameters: [user_id]
build_options:
related_id: forward_parameters.user_id
related_field: sf_guard_user_id
related_class: sfGuardUser
display: [~is_default, company, full_name, address, address_more, region, code, town, countries_id, phone]
fields:
is_default: {name: Domyślny}
company: {name: Firma}
full_name: {name: Imię i nazwisko}
address: {name: Adres, required: true}
address_more: {name: Adres cd}
region: {name: Województwo}
code: {name: Kod, required: true}
town: {name: Miasto, required: true}
countries_id: {name: Kraj, params: "peer_method=doSelectActive"}
phone: {name: Telefon, required: true}
actions:
_list: {name: Pokaż listę}
_save: {name: Zapisz}
edit:
title: Edycja podstawowa
use_stylesheet: [backend/stUser.css]
display:
"NONE": [is_confirm, is_admin_confirm, general_discount_value, _wholesale]
"Dane logowania": [_last_login, username, ~password, ~password_bis]
"Dane bilingowe": [_default_billing_data]
"Dane dostawy": [_default_delivery_data]
fields:
last_login: {name: Ostatnio logowany, type: plain}
username: {name: Użytkownik, params: size=40}
password: {name: Hasło}
password_bis: {name: Powtórz hasło}
is_confirm: {name: Potwierdzony}
is_admin_confirm: {name: Zweryfikowany}
user_order: {name: Zamówienia, type: plain}
user_info: {name: Informacje o kliencie}
default_billing_data: {hide_label: true}
default_delivery_data: {hide_label: true}
general_discount_value: {name: Rabat ogólny, postfix: "%", params: disabled=false size=6}
wholesale: {name: Oznacz klienta jako hurtownika, required: false}
menu:
display: [billing_list, delivery_list]
fields:
_edit: {name: Dane konta, action: stUser/index?user_id=%%id%%}
billing_list: {name: Dane billingowe, action: stUser/userDataBillingList?user_id=%%id%%}
delivery_list: {name: Dane dostawy, action: stUser/userDataDeliveryList?user_id=%%id%%}
actions:
_list: {name: Pokaż listę}
_orders: {name: Zamówienia, action: "@stOrder?action=list&filters[filter_client]=%%username%%", icon: stOrder}
_save: {name: Zapisz}
_delete: {name: Usuń}
_save_and_add: {name: Zapisz i dodaj}
points_edit:
menu: {use: edit.menu}
title: Punkty klienta %%username%%
forward_parameters: [id]
build_options:
related_id: forward_parameters.id
display:
"NONE": [~header_user_info]
"Zmień stan konta": [points, ~operation_description]
fields:
header_user_info: {name: Klient}
points: {name: Aktualny stan konta, help: "Podaj wartość np:<br/> 10 - ustawi aktualny stan konta 10", support: true}
operation_description: {name: Opis operacji, support: true}
actions:
_save: {name: Zapisz}
points_info_edit:
menu: {use: edit.menu}
title: Punkty klienta %%username%%
forward_parameters: [id]
build_options:
related_id: forward_parameters.id
display:
"NONE": [~header_user_info, ~header_user_points_avaible, ~header_user_points_release, ~header_user_points]
"Punkty": [~user_points]
"Zmień stan konta": [~user_points_input_operation, ~user_points_description_operation]
fields:
header_user_info: {name: Klient}
header_user_points_avaible: {name: Możliwość korzystania z punktów}
header_user_points_release: {name: Próg aktywacji punktów}
header_user_points: {name: Stan konta}
user_points: {name: Historia punktów}
user_points_input_operation: {name: Punkty , help: "Podaj wartość np:<br/> +10 - doda do stanu konta 10<br/>-10 - odejmie od stanu konta 10", support: true}
user_points_description_operation: {name: Opis operacji, support: true}
actions:
_save: {name: Dodaj}
user_points_list:
use_helper: [stPoints]
forward_parameters: [user_id]
build_options:
related_id: forward_parameters.user_id
menu: {use: edit.menu}
title: Lista operacji
display: [created_at, change_points_varchar, points, change, description]
fields:
created_at: {name: Data}
change_points_varchar: {name: Operacja}
points: {name: Stan konta}
change: {name: Zmienił, callback: st_points_change}
description: {name: Opis}
actions: []
object_actions: []
select_actions: []

View File

@@ -0,0 +1,2 @@
soap:
is_secure: off

View File

@@ -0,0 +1,429 @@
<?php
/**
* SOTESHOP/stWebApiPlugin
*
* Ten plik należy do aplikacji stWebApiPlugin opartej na licencji (Open License SOTE) Otwarta Licencja SOTE.
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stWebApiPlugin
* @subpackage libs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
* @version $Id: stModuleWebApi.class.php 14410 2011-08-02 08:51:11Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
define( "WEBAPI_CATEGORY_ERROR", "Kategoria o id %d nie istenieje.");
/**
* Klasa stProductWebApi
*
* @package stWebApiPlugin
* @subpackage libs
*/
class stUserWebApi extends autoStUserWebApi
{
public function AddUser( $object )
{
if (isset($object->_culture)) { $this->__setCulture($object->_culture);}
stWebApi::getLogin($object->_session_hash, 'webapi_write');
$this->TestAndValidateAddUserFields( $object );
$c = new Criteria();
$c->add(sfGuardUserPeer::USERNAME, $object->username);
if (sfGuardUserPeer::doCount($c) > 0)
{
throw new SoapFault("2", sprintf($this->__(WEBAPI_VALIDATE_UNIQUE_ERROR), 'username'));
}
$item = new sfGuardUser( );
if ( $item )
{
$this->setFieldsForAddUser( $object, $item );
//Zapisywanie danych do bazy
try {
$item->save( );
} catch ( Exception $e ) {
throw new SoapFault( "2", sprintf($this->__(WEBAPI_ADD_ERROR),$e->getMessage()));
}
self::setAsUser($item);
// Zwracanie danych
$object = new StdClass( );
$this->getFieldsForAddUser( $object, $item );
return $object;
} else {
throw new SoapFault( "1", sprintf($this->__(WEBAPI_ADD_ERROR), "") );
}
}
public function DeleteUser( $object )
{
if (isset($object->_culture)) { $this->__setCulture($object->_culture);}
stWebApi::getLogin($object->_session_hash, 'webapi_write');
$this->TestAndValidateDeleteUserFields( $object );
$item = sfGuardUserPeer::retrieveByPk( $object->id );
if ($item->getIsSuperAdmin() || $item->hasGroup('admin'))
{
throw new SoapFault( "1", 'You can\'t delete an administrator account');
}
if ( $item )
{
// Zwracanie danych
$obj = new StdClass( );
$item->delete( );
$obj->_delete = 1;
return $obj;
} else {
throw new SoapFault( "1", $this->__(WEBAPI_INCORRECT_ID) );
}
}
public static function setAsUser($item)
{
$item->addGroupByName('user');
}
public function GetUserProfileList( $object )
{
if (isset($object->_culture)) { $this->__setCulture($object->_culture);}
stWebApi::getLogin($object->_session_hash, 'webapi_read');
$this->TestAndValidateGetUserProfileListFields( $object );
$c = new Criteria( );
if (isset($object->_modified_from) && isset($object->_modified_to)) {
$criterion = $c->getNewCriterion(UserDataPeer::UPDATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$criterion->addAnd($c->getNewCriterion(UserDataPeer::UPDATED_AT, $object->_modified_to, Criteria::LESS_EQUAL));
$c->add($criterion);
} else {
if (isset($object->_modified_from)) {
$criterion = $c->getNewCriterion(UserDataPeer::UPDATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$c->add($criterion);
}
if (isset($object->_modified_to)) {
$criterion = $c->getNewCriterion(UserDataPeer::UPDATED_AT, $object->_modified_to, Criteria::LESS_EQUAL);
$c->add($criterion);
}
}
if (!isset($object->_limit)) $object->_limit = 20;
// ustawiamy kryteria wyboru
$c->setLimit( $object->_limit );
$c->setOffset( $object->_offset );
if (isset($object->sf_guard_user_id)) {
$c->add(UserDataPeer::SF_GUARD_USER_ID,$object->sf_guard_user_id);
}
$items = UserDataPeer::doSelect( $c );
if ( $items )
{
// Zwracanie wyniku, dla wszystkich pol z tablicy 'out'
$items_array = array();
foreach ( $items as $item )
{
$object = new StdClass( );
$this->getFieldsForGetUserProfileList( $object, $item );
$items_array[] = $object;
}
return $items_array;
} else {
return array( );
}
}
/**
* Licznie ilości rekordów
*
* @return object okiekt z liczba rekordów
* @throws WEBAPI_COUNT_ERROR
*/
public function CountUserProfile( $object )
{
if (isset($object->_culture)) { $this->__setCulture($object->_culture);}
stWebApi::getLogin($object->_session_hash, 'webapi_read');
$c = new Criteria();
if (isset($object->sf_guard_user_id)) {
$c->add(UserDataPeer::SF_GUARD_USER_ID,$object->sf_guard_user_id);
}
try{
//Zwracanie danych
$obj = new StdClass( );
$obj->_count = UserDataPeer::doCount($c);
return $obj;
} catch ( Exception $e ) {
throw new SoapFault( "1", $this->__(WEBAPI_COUNT_ERROR) );
}
}
/**
* Pobieranie danych
*
* @param object $object obiekt z parametrami
* @return object okiekt z danymi
* @throws WEBAPI_INCORRECT_ID WEBAPI_REQUIRE_ERROR
*/
public function GetUser( $object )
{
if (isset($object->_culture)) { $this->__setCulture($object->_culture);}
stWebApi::getLogin($object->_session_hash, 'webapi_read');
$this->TestAndValidateGetUserFields( $object );
$item = sfGuardUserPeer::retrieveByPk( $object->id );
if ($item && !$item->getIsSuperAdmin() && !$item->hasGroup('admin'))
{
$object = new StdClass( );
$this->getFieldsForGetUser( $object, $item );
return $object;
} else {
throw new SoapFault( "1", $this->__(WEBAPI_INCORRECT_ID) );
}
}
public function GetUserList( $object )
{
if (isset($object->_culture)) { $this->__setCulture($object->_culture);}
stWebApi::getLogin($object->_session_hash, 'webapi_read');
$this->TestAndValidateGetUserListFields( $object );
$c = new Criteria( );
if (isset($object->_modified_from) && isset($object->_modified_to)) {
$criterion = $c->getNewCriterion(sfGuardUserPeer::CREATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$criterion->addAnd($c->getNewCriterion(sfGuardUserPeer::CREATED_AT, $object->_modified_to, Criteria::LESS_EQUAL));
$c->add($criterion);
} else {
if (isset($object->_modified_from)) {
$criterion = $c->getNewCriterion(sfGuardUserPeer::CREATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$c->add($criterion);
}
if (isset($object->_modified_to)) {
$criterion = $c->getNewCriterion(sfGuardUserPeer::CREATED_AT, $object->_modified_to, Criteria::LESS_EQUAL);
$c->add($criterion);
}
}
if (!isset($object->_limit)) $object->_limit = 20;
// ustawiamy kryteria wyboru
$c->setLimit( $object->_limit );
$c->setOffset( $object->_offset );
$this->addUserGroupCriteria($c);
$items = sfGuardUserPeer::doSelect( $c );
if ( $items )
{
// Zwracanie wyniku, dla wszystkich pol z tablicy 'out'
$items_array = array();
foreach ( $items as $item )
{
$object = new StdClass( );
$this->getFieldsForGetUserList( $object, $item );
$items_array[] = $object;
}
return $items_array;
} else {
return array( );
}
}
/**
* Licznie ilości rekordów
*
* @return object okiekt z liczba rekordów
* @throws WEBAPI_COUNT_ERROR
*/
public function CountUser( $object )
{
if (isset($object->_culture)) { $this->__setCulture($object->_culture);}
stWebApi::getLogin($object->_session_hash, 'webapi_read');
try{
$c = new Criteria( );
if (isset($object->_modified_from) && isset($object->_modified_to)) {
$criterion = $c->getNewCriterion(sfGuardUserPeer::CREATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$criterion->addAnd($c->getNewCriterion(sfGuardUserPeer::CREATED_AT, $object->_modified_to, Criteria::LESS_EQUAL));
$c->add($criterion);
} else {
if (isset($object->_modified_from)) {
$criterion = $c->getNewCriterion(sfGuardUserPeer::CREATED_AT, $object->_modified_from, Criteria::GREATER_EQUAL);
$c->add($criterion);
}
if (isset($object->_modified_to)) {
$criterion = $c->getNewCriterion(sfGuardUserPeer::CREATED_AT, $object->_modified_to, Criteria::LESS_EQUAL);
$c->add($criterion);
}
}
$this->addUserGroupCriteria($c);
//Zwracanie danych
$obj = new StdClass( );
$obj->_count = sfGuardUserPeer::doCount($c);
return $obj;
} catch ( Exception $e ) {
throw new SoapFault( "1", sprintf($this->__(WEBAPI_COUNT_ERROR),$e->getMessage()) );
}
}
public function getFieldsForGetUserProfileList( $object, $item ) {
parent::getFieldsForGetUserProfileList($object, $item);
if (method_exists($item, "getStreet")) {
$street = $item->getStreet();
if (empty($street)) {
$aparser = new stAddressParser($item->getAddress());
$result = $aparser->getAddress();
$street = $result['s1'];
}
$object->street = stWebApi::formatData($street, "string");
}
if (method_exists($item, "getHouse")) {
$house = $item->getHouse();
if (empty($house)) {
$aparser = new stAddressParser($item->getAddress());
$result = $aparser->getAddress();
$house = $result['n1'];
}
$object->house = stWebApi::formatData($house, "string");
}
if (method_exists($item, "getFlat")) {
$flat = $item->getFlat();
if (empty($flat)) {
$aparser = new stAddressParser($item->getAddress());
$result = $aparser->getAddress();
$flat = $result['n2'];
}
$object->flat = stWebApi::formatData($flat, "string");
}
}
public function getFieldsForGetUserProfile( $object, $item ) {
parent::getFieldsForGetUserProfile($object, $item);
if (method_exists($item, "getStreet")) {
$street = $item->getStreet();
if (empty($street)) {
$aparser = new stAddressParser($item->getAddress());
$result = $aparser->getAddress();
$street = $result['s1'];
}
$object->street = stWebApi::formatData($street, "string");
}
if (method_exists($item, "getHouse")) {
$house = $item->getHouse();
if (empty($house)) {
$aparser = new stAddressParser($item->getAddress());
$result = $aparser->getAddress();
$house = $result['n1'];
}
$object->house = stWebApi::formatData($house, "string");
}
if (method_exists($item, "getFlat")) {
$flat = $item->getFlat();
if (empty($flat)) {
$aparser = new stAddressParser($item->getAddress());
$result = $aparser->getAddress();
$flat = $result['n2'];
}
$object->flat = stWebApi::formatData($flat, "string");
}
}
public static function getDiscount(sfGuardUser $user)
{
$discounts = $user->getDiscountUsers();
return $discounts ? $discounts[0]->getDiscount() : 0;
}
public static function setDiscount(sfGuardUser $user, $value)
{
$discounts = $user->getDiscountUsers();
if (!$discounts)
{
$discount = new DiscountUser();
$user->addDiscountUser($discount);
}
else
{
$discount = $discounts[0];
}
$discount->setDiscount($value);
}
public static function getWholesale($item) {
switch ($item->getWholesale()) {
case 'a':
return 1;
case 'b':
return 2;
case 'c':
return 3;
default:
return 0;
}
}
public static function setWholesale($item, $v) {
switch ($v) {
case '1':
$v = 'a';
break;
case '2':
$v = 'b';
break;
case '3':
$v = 'c';
break;
default:
$v = 0;
break;
}
$item->setWholesale($v);
}
protected function addUserGroupCriteria(Criteria $c)
{
$group = sfGuardGroupPeer::retrieveByName('user');
if (!$group)
{
throw new SoapFault( "1", sprintf($this->__(WEBAPI_COUNT_ERROR),'User group does not exist'));
}
$c->addJoin(sfGuardUserPeer::ID, sfGuardUserGroupPeer::USER_ID);
$c->add(sfGuardUserGroupPeer::GROUP_ID, $group->getId());
}
}

View File

@@ -0,0 +1,5 @@
<?php
class stUserBreadcrumbsBuilder extends autoStUserBreadcrumbsBuilder
{
}

View File

@@ -0,0 +1 @@
<?php echo $username; ?>

View File

@@ -0,0 +1,6 @@
<?php use_helper('stText'); ?>
<?php if($company && $company!="-"): ?>
<?php echo '<a class="list_tooltip" href="'.st_url_for('stUser/edit?id='.$id).'" title="'.$company.'">'.truncate_text($company, '30', '...').'</a>'; ?>
<?php else: ?>
<?php echo "-"; ?>
<?php endif; ?>

View File

@@ -0,0 +1,13 @@
<?php
/**
* @var sfGuardUser $sf_guard_user
*/
?>
<div>
<?php if ($sf_guard_user->getDefaultUserBillingData()): ?>
<?php st_include_partial('user_data', array('user_data' => $sf_guard_user->getDefaultUserBillingData())); ?>
<?php echo st_get_admin_button('edit', __('Edytuj'), "@stUser?action=userDataBillingEdit&user_id=".$sf_guard_user->getId()) ?>
<?php else: ?>
<?php echo st_get_admin_button('edit', __("Uzupełnij dane"), "@stUser?action=userDataBillingEdit&user_id=".$sf_guard_user->getId()); ?>
<?php endif ?>
</div>

View File

@@ -0,0 +1,13 @@
<?php
/**
* @var sfGuardUser $sf_guard_user
*/
?>
<div>
<?php if ($sf_guard_user->getDefaultUserDeliveryData()): ?>
<?php st_include_partial('user_data', array('user_data' => $sf_guard_user->getDefaultUserDeliveryData())); ?>
<?php echo st_get_admin_button('edit', __('Edytuj'), "@stUser?action=userDataDeliveryEdit&user_id=".$sf_guard_user->getId()) ?>
<?php else: ?>
<?php echo st_get_admin_button('edit', __("Uzupełnij dane"), "@stUser?action=userDataDeliveryEdit&user_id=".$sf_guard_user->getId()); ?>
<?php endif ?>
</div>

View File

@@ -0,0 +1,2 @@
<?php
echo st_tokenizer_input_tag($options['control_name'], array(), $defaults, array('tokenizer' => array('preventDuplicates' => true, 'hintText' => __('Wpisz nazwę szukanej grupy'))));

View File

@@ -0,0 +1 @@
<?php echo input_tag('filters[filter_company]', isset($filters['filter_company']) ? $filters['filter_company'] : '', 'size=15') ?>

View File

@@ -0,0 +1 @@
<?php echo input_tag('filters[filter_full_name]', isset($filters['filter_full_name']) ? $filters['filter_full_name'] : '', 'size=15') ?>

View File

@@ -0,0 +1,4 @@
<?php echo select_tag('filters[is_admin_confirm]', options_for_select(array(1 => __('tak', array(), 'stAdminGeneratorPlugin'), 0 => __('nie', array(), 'stAdminGeneratorPlugin')), isset($filters['is_admin_confirm']) ? $filters['is_admin_confirm'] : null, array (
'include_custom' => __("---", null, 'stAdminGeneratorPlugin'),
)), array (
)) ?>

View File

@@ -0,0 +1,4 @@
<?php
use_helper('stWholesale');
echo wholesale_group_select_tag('filters[wholesale_list]', isset($filters['wholesale_list']) ? $filters['wholesale_list'] : null, array('include_custom' => '---'));

View File

@@ -0,0 +1,9 @@
<?php use_helper('stTooltip'); ?>
<?php if($full_name && $full_name!='-'): ?>
<a class="list_tooltip bs-d-inline-flex bs-align-items-center align-middle" href="<?php echo st_url_for('stUser/edit?id='.$id) ?>" title="<?php echo $full_name ?>">
<?php echo st_admin_get_icon('user', ['class' => 'bs-me-1', 'style' => 'min-width: 20px']) ?>
<?php echo st_admin_truncate_text($full_name) ?>
</a>
<?php else: ?>
<?php echo ""; ?>
<?php endif; ?>

View File

@@ -0,0 +1 @@
<?php echo link_to($user->getUsername(), 'stUser/edit?id='.$user->getId())?>

View File

@@ -0,0 +1,2 @@
<span style="font-size: 14px;"><?php echo $user->getPoints()." ".$points_shortcut;?></span>
<?php echo link_to(__('zmień'), 'stUser/pointsEdit?id='.$user->getId())?>

View File

@@ -0,0 +1,10 @@
<?php
if($user->getPointsAvailable()==1){
echo "<b style='color:green;'>".__('włączona')."</b> / ";
echo link_to(__('wyłącz'), 'stUser/pointsAvailable?on=0&user_id='.$user->getId());
} else{
echo "<b style='color:red;'>".__('wyłączona')."</b> / ";
echo link_to(__('włącz'), 'stUser/pointsAvailable?on=1&user_id='.$user->getId());
}
?>

View File

@@ -0,0 +1,10 @@
<?php if(stPoints::isReleasePointsSystemForUser($user->getId())=="release_on"){
echo "<b style='color:green;'>".__('osiągnięty')."</b>";
echo " (".link_to(__('dezaktywuj'), 'stUser/pointsRelease?on=0&user_id='.$user->getId()).")";
}elseif(stPoints::isReleasePointsSystemForUser($user->getId())=="release_off"){
echo __('nieokreślony');
}else{
echo __('do aktywacji brak').": <b style='color:red;'>".stPoints::isReleasePointsSystemForUser($user->getId())." ".$points_shortcut."</b>";
echo " (".link_to(__('aktywuj'), 'stUser/pointsRelease?on=1&user_id='.$user->getId()).")";
}
?>

View File

@@ -0,0 +1,6 @@
<?php if($user_data->getIsDefault()==1): ?>
<?php echo st_admin_checkbox_tag('user_data[is_default]', $user_data->getIsDefault(), $user_data->getIsDefault(), array('disabled' => 'disabled')); ?>
<?php echo input_hidden_tag('user_data[is_default]', '1'); ?>
<?php else: ?>
<?php echo st_admin_checkbox_tag('user_data[is_default]', 1, $user_data->getIsDefault()); ?>
<?php endif; ?>

View File

@@ -0,0 +1,3 @@
<?php
echo $sf_guard_user->getLastLogin() ? st_format_date($sf_guard_user->getLastLogin()) : __('Brak');

View File

@@ -0,0 +1 @@
<textarea class="support" style="width: 300px;" id="sf_guard_user_operation_description" name="sf_guard_user[operation_description]"><?php echo $description; ?></textarea>

View File

@@ -0,0 +1 @@
<?php echo input_password_tag('sf_guard_user[password]', '', array('control_name' => 'sf_guard_user[password]', 'value' => '')) ?>

View File

@@ -0,0 +1 @@
<?php echo input_password_tag('sf_guard_user[password_bis]', '', array('control_name' => 'sf_guard_user[password_bis]')) ?>

View File

@@ -0,0 +1,81 @@
<?php use_helper('stWidgets'); ?>
<?php echo st_open_widget('User', __('Klienci')) ?>
<div style="float:right;">
<?php echo __('Ostatnie', null, 'stBackendMain'); ?>:
<?php if($date_type == "day"): ?>
<b><?php echo link_to_remote(__('24h', null, 'stBackendMain'), array('update'=>'register-user-widget', 'url'=>'stUser/registerUserWidget?date_type=day',)) ?></b>
<?php else: ?>
<?php echo link_to_remote(__('24h', null, 'stBackendMain'), array('update'=>'register-user-widget', 'url'=>'stUser/registerUserWidget?date_type=day',)) ?>
<?php endif; ?>
<?php if($date_type == "week"): ?>
<b><?php echo link_to_remote(__('7 dni', null, 'stBackendMain'), array('update'=>'register-user-widget', 'url'=>'stUser/registerUserWidget?date_type=week',)) ?></b>
<?php else: ?>
<?php echo link_to_remote(__('7 dni', null, 'stBackendMain'), array('update'=>'register-user-widget', 'url'=>'stUser/registerUserWidget?date_type=week',)) ?>
<?php endif; ?>
<?php if($date_type == "month"): ?>
<b><?php echo link_to_remote(__('miesiąc', null, 'stBackendMain'), array('update'=>'register-user-widget', 'url'=>'stUser/registerUserWidget?date_type=month',)) ?></b>
<?php else: ?>
<?php echo link_to_remote(__('miesiąc', null, 'stBackendMain'), array('update'=>'register-user-widget', 'url'=>'stUser/registerUserWidget?date_type=month',)) ?>
<?php endif; ?>
<?php if($date_type == "lastlog"): ?>
<b><?php echo link_to_remote(__('logowanie', null, 'stBackendMain'), array('update'=>'register-user-widget', 'url'=>'stUser/registerUserWidget?date_type=lastlog',)) ?></b>
<?php else: ?>
<?php echo link_to_remote(__('logowanie', null, 'stBackendMain'), array('update'=>'register-user-widget', 'url'=>'stUser/registerUserWidget?date_type=lastlog',)) ?>
<?php endif; ?>
</div>
<?php echo st_link_to(__('Nowi Klienci'), 'stUser/'); ?> (<?php echo $userQuantity; ?>)
<table class="st_record_list" cellspacing="0" width="100%">
<tbody>
<?php if($userInfo!=""): ?>
<?php foreach ($userInfo as $index => $user): ?>
<tr class="<?php
$date = explode(" ",$user['created_at']);
if($date[0]== date('Y-m-d')){ echo ' st_row-new';}else{
echo $index % 2 ? 'st_row-highlight' : 'st_row-no-highlight';
};
?>">
<td>
<div style="text-align: left">
<?php if ($user['id']): ?>
<?php if ($user['company']!=""): ?>
<?php echo $user['company'] ?>
<?php else: ?>
<?php echo $user['fullname'] ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($user['id']): ?>
<?php echo st_external_link_to(truncate_text($user['username'], 25), 'user/edit?id=' . $user['id']) ?>
<?php endif; ?>
</div>
</td>
</tr>
<?php endforeach ; ?>
<?php else: ?>
<tr><td><?php __('Brak klientów') ?></td></tr>
<?php endif; ?>
</tbody>
</table>
<?php echo st_close_widget();?>

View File

@@ -0,0 +1,2 @@
<?php echo input_hidden_tag('discount_user[sf_guard_user_id]',$forward_parameters['user_id'])?>
<?php echo ($discount_user->getSfGuardUser())?$discount_user->getSfGuardUser()->getUsername():sfGuardUserPeer::retrieveByPk($forward_parameters['user_id'])->getUsername(); ?>

View File

@@ -0,0 +1,9 @@
<?php if($id != ""): ?>
<?php if($admin_confirm == 1): ?>
<span style="color: green;"><?php echo __("Dane zostały zweryfikowane.") ?></span>
<?php echo input_hidden_tag('partner_data[is_admin_confirm]', 1); ?>
<?php else: ?>
<span style="color: red;"><?php echo link_to(__("Oznacz klienta jako zweryfikowanego."),"/user/updateAdminConfirm?id=".$id) ?></span>
<?php echo input_hidden_tag('partner_data[is_admin_confirm]', 0); ?>
<?php endif; ?>
<?php endif; ?>

View File

@@ -0,0 +1,9 @@
<?php if($id != ""): ?>
<?php if($confirm == 1): ?>
<span style="color: green;"><?php echo __("Dane zostały potwierdzone.") ?></span>
<?php echo input_hidden_tag('partner_data[is_confirm]', 1); ?>
<?php else: ?>
<span style="color: red;"><?php echo link_to(__("Zatwierdz dane."),"/user/updateConfirm?id=".$id) ?></span>
<?php echo input_hidden_tag('partner_data[is_confirm]', 0); ?>
<?php endif; ?>
<?php endif; ?>

View File

@@ -0,0 +1,13 @@
<?php if($id != ""): ?>
<div style="width: 200px;margin-top: 11px;float: left;">
<h3><?php echo __('Dane bilingowe') ?></h3>
<?php st_include_partial('user_data', array('user_data' => $user_data_billing)); ?>
</div>
<div style="width: 240px;margin-top: 11px;margin-left: 30px; float: left;">
<h3><?php echo __('Dane dostawy') ?></h3>
<?php st_include_partial('user_data', array('user_data' => $user_data_delivery)); ?>
</div>
<br class="st_clear_all" />
<?php endif; ?>

View File

@@ -0,0 +1 @@
<?php echo link_to(__("Pokaż zamówienia klienta."),"/order?filters[filter_client]=".$username) ?>

View File

@@ -0,0 +1,63 @@
<?php use_helper('stCurrency'); ?>
<?php if($id != "" && $transactions):
?>
<table cellspacing="0" cellpadding="3" class="st_record_list">
<tr>
<th style='text-align:center;width:140px;'><?php echo __('Data') ?></th>
<th style='text-align:right; width:70px;'><?php echo __('Operacja') ?></th>
<th style='text-align:right; width:70px;'><?php echo __('Stan konta') ?></th>
<th style='text-align:center; width:200px;'><?php echo __('Zmienił') ?></th>
<th style='text-align:center; width:225px;'><?php echo __('Opis') ?> </th>
</tr>
<?php
$i=0;
foreach ($transactions as $transaction) {
$i++;
if($i <= 5){
echo "<tr>";
echo "<td style='text-align:center;'>".$transaction -> getCreatedAt()."</td>";
$change = $transaction -> getChangePointsVarchar();
if ($change{0} == "-") {
echo "<td style='text-align:right;'><span style='color:red'>" . $transaction -> getChangePointsVarchar() . "</span></td>";
} else {
echo "<td style='text-align:right;'><span style='color:green'>" . $transaction -> getChangePointsVarchar() . "</span></td>";
}
echo "<td style='text-align:right;'>" . $transaction -> getPoints(). "</td>";
if($transaction -> getAdminId() && !$transaction -> getOrderId()){
echo "<td style='text-align:center;'>" . link_to(__($transaction ->getSfGuardUserRelatedByAdminId() -> getUsername()),"sfGuardUser/edit?id=".$transaction ->getSfGuardUserRelatedByAdminId() -> getId()). "</td>";
}
if($transaction -> getOrderId()){
echo "<td style='text-align:center;'>" . link_to(__("Zam").": ".$transaction ->getOrderNumber(),"/order/edit?id=".$transaction ->getOrderId()). "</td>";
}
$i18n = sfContext::getInstance() -> getI18n();
echo "<td style='text-align:center;'>" . $i18n -> __($transaction -> getDescription()). "</td>";
echo "</tr>";
}
if($i == 5){
?>
<tr><th style='text-align:center;'><a href="/backend.php/user/userPointsList/user_id/<?php echo $user->getId(); ?>/type/desc/page/1"> <?php echo __('pokaż starsze'); ?> </a></th><th style='text-align:center;' colspan="4"></th></tr>
<?php
}
}
?>
</table>
<?php else: ?>
<?php echo __('Brak operacji na koncie') ?>
<?php endif; ?>

View File

@@ -0,0 +1 @@
<textarea class="support" style="width: 300px;" id="sf_guard_user_operation_description" name="sf_guard_user[operation_description]"><?php echo $description; ?></textarea>

View File

@@ -0,0 +1 @@
<input type="text" class="support" size="7" value="<?php echo $points; ?>" id="sf_guard_user_points" name="sf_guard_user[user_points]">

View File

@@ -0,0 +1,35 @@
<address style="font-style: normal">
<?php if ($user_data->getCompany()) : ?>
<p>
<?php echo $user_data->getCompany(); ?>
</p>
<?php endif; ?>
<p>
<span class="st_order-address-name" style="font-weight: bold;"><?php echo $user_data->getFullName(); ?></span>
</p>
<p style="padding: 8px 0px;">
<span class="st_order-address-street"><?php echo $user_data->getAddress(); ?></span><br />
<?php if ($user_data->getAddressMore()) : ?>
<span class="st_order-address-street"><?php echo $user_data->getAddressMore(); ?></span><br />
<?php endif; ?>
<?php if ($user_data->getRegion()) : ?>
<span class="st_order-address-street"><?php echo $user_data->getRegion(); ?></span><br />
<?php endif; ?>
<span class="st_order-address-code"><?php echo $user_data->getCode() ?></span>
<span class="st_order-address-town"><?php echo $user_data->getTown() ?></span>,
<span class="st_order-address-country"><?php echo $user_data->getcountries() ?></span>
<?php if ($user_data->getPesel()) : ?>
<br><span class="st_order-address-town"><?php echo __('PESEL') ?>&nbsp;<?php echo $user_data->getPesel(); ?></span>
<?php endif; ?>
</p>
<p>
<?php echo __('Tel') ?>.:&nbsp;<?php echo $user_data->getPhone() ?>
</p>
<?php if ($user_data->getIsBilling() == 1) : ?>
<?php if ($user_data->getVatNumber()) : ?>
<p>
<?php echo __('NIP') ?>:&nbsp;<?php echo $user_data->getVatNumber() ?>
</p>
<?php endif; ?>
<?php endif; ?>
</address>

View File

@@ -0,0 +1,72 @@
<?php
// auto-generated by sfPropelAdmin
// date: 2013/11/26 10:43:46
?>
<?php $list_mode = $sf_user->getAttribute('userPointsList.mode', null, 'soteshop/stAdminGenerator/stUser/config'); ?>
<?php if ($list_mode != 'edit'): ?>
<td class="column_created_at" style="">
<?php echo ($user_points->getCreatedAt() !== null && $user_points->getCreatedAt() !== '') ? st_format_date($user_points->getCreatedAt(), "dd-MM-yyyy H:mm") : '' ?>
</td>
<?php else: ?>
<td class="column_created_at" style="">
<?php echo ($user_points->getCreatedAt() !== null && $user_points->getCreatedAt() !== '') ? st_format_date($user_points->getCreatedAt(), "dd-MM-yyyy H:mm") : '' ?>
</td>
<?php endif; ?>
<?php if ($list_mode != 'edit'): ?>
<td class="column_change_points_varchar" style="">
<?php echo $user_points->getChangePointsVarchar() ?>
</td>
<?php else: ?>
<td class="column_change_points_varchar" style="">
<?php echo $user_points->getChangePointsVarchar() ?>
</td>
<?php endif; ?>
<?php if ($list_mode != 'edit'): ?>
<td class="column_points" style="">
<?php echo $user_points->getPoints() ?>
</td>
<?php else: ?>
<td class="column_points" style="">
<?php echo $user_points->getPoints() ?>
</td>
<?php endif; ?>
<?php if ($list_mode != 'edit'): ?>
<td class="column_change" style="">
<?php echo st_points_change($user_points); ?>
</td>
<?php else: ?>
<td class="column_change" style="">
<?php echo st_points_change($user_points, $list_mode); ?>
</td>
<?php endif; ?>
<?php if ($list_mode != 'edit'): ?>
<td class="column_description" style="">
<?php
$i18n = sfContext::getInstance() -> getI18n();
echo $i18n -> __($user_points->getDescription());
?>
</td>
<?php else: ?>
<td class="column_description" style="">
<?php
$i18n = sfContext::getInstance() -> getI18n();
echo $i18n -> __($user_points->getDescription());
?>
</td>
<?php endif; ?>

View File

@@ -0,0 +1,3 @@
<?php use_helper('stTooltip'); ?>
<?php echo '<a class="list_tooltip" href="'.st_url_for('stUser/edit?id='.$id).'" title="'.$username.'">'.link_to(truncate_text($username, '70', '...'), 'stUser/edit?id='.$id); ?>

View File

@@ -0,0 +1,3 @@
<?php
use_helper('stWholesale');
echo wholesale_group_select_tag('sf_guard_user[wholesale]', $sf_guard_user->getWholesale());

View File

@@ -0,0 +1 @@
<?php echo $sf_guard_user->getWholesale() ? ucfirst($sf_guard_user->getWholesale()) : '&nbsp;' ?>

View File

@@ -0,0 +1,84 @@
<?php use_helper('I18N', 'Text', 'stAdminGenerator', 'Object', 'ObjectAdmin', 'stDate', 'stProductImage','stCurrency') ?>
<?php use_helper('stWidgets'); ?>
<div class="list_filters">
<div style="float:right;">
<?php echo __('Ostatnie', null, 'stBackendMain'); ?>:
<?php if($date_type == "day"): ?>
<b><?php echo st_link_to(__('24h', null, 'stBackendMain'),'stUser/registerUserWidget?date_type=day'); ?></b>
<?php else: ?>
<?php echo st_link_to(__('24h', null, 'stBackendMain'),'stUser/registerUserWidget?date_type=day'); ?>
<?php endif; ?>
<?php if($date_type == "week"): ?>
<b><?php echo st_link_to(__('7 dni', null, 'stBackendMain'),'stUser/registerUserWidget?date_type=week'); ?></b>
<?php else: ?>
<?php echo st_link_to(__('7 dni', null, 'stBackendMain'),'stUser/registerUserWidget?date_type=week'); ?>
<?php endif; ?>
<?php if($date_type == "month"): ?>
<b><?php echo st_link_to(__('miesiąc', null, 'stBackendMain'),'stUser/registerUserWidget?date_type=month'); ?></b>
<?php else: ?>
<?php echo st_link_to(__('miesiąc', null, 'stBackendMain'),'stUser/registerUserWidget?date_type=month'); ?>
<?php endif; ?>
<?php if($date_type == "lastlog"): ?>
<b><?php echo st_link_to(__('logowanie', null, 'stBackendMain'),'stUser/registerUserWidget?date_type=lastlog'); ?></b>
<?php else: ?>
<?php echo st_link_to(__('logowanie', null, 'stBackendMain'),'stUser/registerUserWidget?date_type=lastlog'); ?>
<?php endif; ?>
</div>
<?php echo st_link_to(__('Nowi Klienci'), 'stUser/'); ?> (<?php echo $userQuantity; ?>)
</div>
<?php if($userInfo!=""): ?>
<div id="sf_admin_container">
<table class="st_record_list" cellspacing="0" width="100%">
<tbody>
<?php foreach ($userInfo as $index => $user): ?>
<tr class="<?php
$date = explode(" ",$user['created_at']);
if($date[0]== date('Y-m-d')){ echo ' st_row-new';}else{
echo $index % 2 ? 'st_row-highlight' : 'st_row-no-highlight';
};
?>">
<td>
<div style="text-align: left">
<?php if ($user['id']): ?>
<?php if ($user['company']!=""): ?>
<?php echo $user['company'] ?>
<?php else: ?>
<?php echo $user['fullname'] ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($user['id']): ?>
<?php echo st_external_link_to(truncate_text($user['username'], 25), 'user/edit?id=' . $user['id']) ?>
<?php endif; ?>
</div>
</td>
</tr>
<?php endforeach ; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p style="text-align: center; margin-top: 20px"><?php echo __('Brak klientów') ?></p>
<?php endif; ?>

View File

@@ -0,0 +1,309 @@
<!-- http://templates.mailchimp.com/resources/inline-css/ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="margin: 0;padding: 0;font-family: Arial, sans-serif;">
<head style="margin: 0;padding: 0;font-family: Arial, sans-serif;">
<meta name="viewport" content="width=device-width" style="margin: 0;padding: 0;font-family: Arial, sans-serif;">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" style="margin: 0;padding: 0;font-family: Arial, sans-serif;">
<title style="margin: 0;padding: 0;font-family: Arial, sans-serif;">ZURBemails</title>
<style style="margin: 0;padding: 0;font-family: Arial, sans-serif;">
/* -------------------------------------
GLOBAL
------------------------------------- */
* {
margin:0;
padding:0;
}
* { font-family: Arial, sans-serif; }
img {
max-width: 100%;
}
.collapse {
margin:0;
padding:0;
}
body {
-webkit-font-smoothing:antialiased;
-webkit-text-size-adjust:none;
width: 100%!important;
height: 100%;
}
/* -------------------------------------
ELEMENTS
------------------------------------- */
a { color: #<?php echo $mail_config->get('link_color'); ?>;}
.btn {
text-decoration:none;
color: #FFF;
background-color: #666;
padding:10px 16px;
font-weight:bold;
margin-right:10px;
text-align:center;
cursor:pointer;
display: inline-block;
}
p.callout {
padding:15px;
background-color:#ECF8FF;
margin-bottom: 15px;
}
.callout a {
font-weight:bold;
color: #2BA6CB;
}
table.social {
background-color: #ebebeb;
}
.social .soc-btn {
padding: 3px 7px;
font-size:12px;
margin-bottom:10px;
text-decoration:none;
color: #FFF;font-weight:bold;
display:block;
text-align:center;
}
a.fb { background-color: #3B5998!important; }
a.tw { background-color: #1daced!important; }
a.gp { background-color: #DB4A39!important; }
a.ms { background-color: #000!important; }
.sidebar .soc-btn {
display:block;
width:100%;
}
/* -------------------------------------
HEADER
------------------------------------- */
table.head-wrap { width: 100%;}
.header.container table td.logo { padding: 15px; }
.header.container table td.label { padding: 15px; padding-left:0px;}
/* -------------------------------------
BODY
------------------------------------- */
table.body-wrap { width: 100%;}
/* -------------------------------------
FOOTER
------------------------------------- */
table.footer-wrap { width: 100%; clear:both!important;
}
.footer-wrap .container td.content p { border-top: 1px solid rgb(215,215,215); padding-top:15px;}
.footer-wrap .container td.content p {
font-size:10px;
font-weight: bold;
}
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
h1,h2,h3,h4,h5,h6 {
font-family: Arial, sans-serif; line-height: 1.1; margin-bottom:15px; color:#000;
}
h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { font-size: 60%; color: #6f6f6f; line-height: 0; text-transform: none; }
h1 { font-weight:200; font-size: 44px;}
h2 { font-weight:200; font-size: 37px;}
h3 { font-weight:500; font-size: 27px;}
h4 { font-weight:500; font-size: 23px;}
h5 { font-weight:900; font-size: 17px;}
h6 { font-weight:900; font-size: 14px; text-transform: uppercase; color:#444;}
.collapse { margin:0!important;}
p, ul {
margin-bottom: 10px;
font-weight: normal;
font-size:12px;
line-height:1.6;
}
p.lead { font-size:17px; }
p.last { margin-bottom:0px;}
ul li {
margin-left:5px;
list-style-position: inside;
}
/* -------------------------------------
SIDEBAR
------------------------------------- */
ul.sidebar {
background:#ebebeb;
display:block;
list-style-type: none;
}
ul.sidebar li { display: block; margin:0;}
ul.sidebar li a {
text-decoration:none;
color: #666;
padding:10px 16px;
/* font-weight:bold; */
margin-right:10px;
/* text-align:center; */
cursor:pointer;
border-bottom: 1px solid #777777;
border-top: 1px solid #FFFFFF;
display:block;
margin:0;
}
ul.sidebar li a.last { border-bottom-width:0px;}
ul.sidebar li a h1,ul.sidebar li a h2,ul.sidebar li a h3,ul.sidebar li a h4,ul.sidebar li a h5,ul.sidebar li a h6,ul.sidebar li a p { margin-bottom:0!important;}
/* ---------------------------------------------------
RESPONSIVENESS
Nuke it from orbit. It's the only way to be sure.
------------------------------------------------------ */
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
.container {
display:block!important;
max-width:600px!important;
margin:0 auto!important; /* makes it centered */
clear:both!important;
}
/* This should also be a block element, so that it will fill 100% of the .container */
.content {
padding:15px;
max-width:600px;
margin:0 auto;
display:block;
}
/* Let's make sure tables in the content area are 100% wide */
.content table { width: 100%; }
/* Odds and ends */
.column {
width: 300px;
float:left;
}
.social .column tr td { padding: 15px; }
.user_data .column tr td { padding-bottom: 15px; }
.column-wrap {
padding:0!important;
margin:0 auto;
max-width:600px!important;
}
.column table { width:100%;}
.social .column {
width: 280px;
min-width: 279px;
float:left;
}
.user_data .column {
width: 280px;
min-width: 279px;
float:left;
}
/* Be sure to place a .clear element after each set of columns, just to be safe */
.clear { display: block; clear: both; }
/* -------------------------------------------
PHONE
For clients that support media queries.
Nothing fancy.
-------------------------------------------- */
@media only screen and (max-width: 600px) {
a[class="btn"] { display:block!important; margin-bottom:10px!important; background-image:none!important; margin-right:0!important;}
div[class="column"] { width: auto!important; float:none!important;}
table.social div[class="column"] {
width:auto!important;
}
}
</style>
</head>
<body bgcolor="#FFFFFF" style="margin: 0;padding: 0;font-family: Arial, sans-serif;font-size: 12px;-webkit-font-smoothing: antialiased;-webkit-text-size-adjust: none;height: 100%;width: 100%!important;">
<!-- HEADER -->
<table class="head-wrap" bgcolor="#<?php echo $mail_config->get('bg_header_color'); ?>" style="margin: 0;padding: 0;font-family: Arial, sans-serif;font-size: 12px;width: 100%;">
<tr style="margin: 0;padding: 0;font-family: Arial, sans-serif;font-size: 12px;">
<td style="margin: 0;padding: 0;font-family: Arial, sans-serif;font-size: 12px;"></td>
<td class="header container" style="margin: 0 auto!important;padding: 0;font-family: Arial, sans-serif;font-size: 12px;display: block!important;max-width: 600px!important;clear: both!important;">
<div class="content" style="margin: 0 auto;padding: 15px;font-family: Arial, sans-serif;font-size: 12px;max-width: 600px;display: block;">
<table bgcolor="#<?php echo $mail_config->get('bg_header_color'); ?>" style="margin: 0;padding: 0;font-family: Arial, sans-serif;font-size: 12px;width: 100%;">
<tr style="margin: 0;padding: 0;font-family: Arial, sans-serif;font-size: 12px;">
<td style="margin: 0;padding: 0;font-family: Arial, sans-serif;font-size: 12px;"><?php if ($mail_config->get('logo')!=""): ?><img src="http://<?php echo $sf_request->getHost(); ?>/uploads<?php echo $mail_config->get('logo'); ?>?version=1" style="margin: 0;padding: 0;font-family: Arial, sans-serif;font-size: 12px;max-width: 100%; max-height: 50px;"><?php endif; ?></td>
<td align="right" style="margin: 0;padding: 0;font-family: Arial, sans-serif;"><h6 class="collapse" style="margin: 0!important;padding: 0;font-family: &quot;helveticaneue-light&quot: ;, &quot: ;helvetica neue light&quot: ;helvetica neue&quot: ;, helvetica, arial, &quot: ;lucida grande&quot: ;, sans-serif: ;line-height: 1.1;margin-bottom: 15px;color: #444;font-weight: 900;font-size: 14px;text-transform: uppercase;"><?php echo date('d-m-Y H:i'); ?></h6></td>
</tr>
</table>
</div>
</td>
<td style="margin: 0;padding: 0;font-family: Arial, sans-serif;"></td>
</tr>
</table><!-- /HEADER -->
<table class="body-wrap" cellpadding="0" cellspacing="0" style="margin: 0;padding: 0;font-family: Arial, sans-serif;width: 100%;">
<tr style="margin: 0;padding: 0;font-family: Arial, sans-serif;">
<td style="margin: 0;padding: 0;font-family: Arial, sans-serif;"></td>
<td class="container" bgcolor="#FFFFFF" style="margin: 0 auto!important;padding: 0;font-family: Arial, sans-serif;display: block!important;max-width: 600px!important;clear: both!important;">
<div class="content" style="margin: 0 auto;padding: 15px;font-family: Arial, sans-serif;max-width: 600px;display: block;">
<table cellpadding="0" cellspacing="0" style="margin: 0;padding: 0;font-family: Arial, sans-serif;width: 100%;">
<tr style="margin: 0;padding: 0;font-family: Arial, sans-serif;">
<td style="margin: 0;padding: 0;font-family: Arial, sans-serif;">
<p style="font-size: 12px;margin: 0;padding: 0;font-family: Arial, sans-serif;margin-bottom: 10px;font-weight: normal;line-height: 1.6;"><?php echo $head; ?></p>
<h4 style="margin: 0;padding: 0;font-family: &quot;helveticaneue-light&quot: ;, &quot: ;helvetica neue light&quot: ;helvetica neue&quot: ;, helvetica, arial, &quot: ;lucida grande&quot: ;, sans-serif: ;line-height: 1.1;margin-bottom: 15px;color: #000;font-weight: 500;font-size: 23px;"><?php echo __('Weryfikacja danych klienta') ?></h4>
</br>
<p style="font-size: 12px;margin: 0;padding: 0;font-family: Arial, sans-serif;margin-bottom: 10px;font-weight: normal;line-height: 1.6;"><?php echo $content; ?></p>
<!-- social & contact -->
<table class="social" width="100%" style="margin: 0;padding: 0;font-family: Arial, sans-serif;background-color: #<?php echo $mail_config->get('bg_footer_color'); ?>;width: 100%;">
<tr style="margin: 0;padding: 0;font-family: Arial, sans-serif;">
<td style="font-size: 12px;margin: 0;padding: 0;font-family: Arial, sans-serif;">
<?php echo $foot; ?>
</td>
</tr>
</table><!-- /social & contact -->
</td>
</tr>
</table>
</div><!-- /content -->
</td>
<td style="margin: 0;padding: 0;font-family: Arial, sans-serif;"></td>
</tr>
</table><!-- /BODY -->
</body>

View File

@@ -0,0 +1,3 @@
<?php use_helper('stUrl') ?>
<?php echo stHtml2Text::convert($content); ?>

View File

@@ -0,0 +1,14 @@
fillin:
enabled: true
fields:
discount_user{discount}:
required:
msg: Proszę podać warość rabatu
sfNumberValidator:
nan_error: Proszę podać wartość liczbową
min: 0
min_error: Minimalna wartość rabatu to 0%
max: 100
max_error: Maksymalna wartość rabatu to 100%

View File

@@ -0,0 +1,17 @@
fields:
sf_guard_user{username}:
required:
msg: Nie podałeś adresu e-mail
sfStringValidator:
max: 60
max_error: Przekroczono dozwoloną liczbę znaków.
sfEmailValidator:
email_error: Nieprawidłowy format adresu e-mail.
sfPropelUniqueValidator:
class: sfGuardUser
column: username
unique_error: Taki adres już istnieje w bazie danych.

View File

@@ -0,0 +1,32 @@
fields:
user_data{address}:
required:
msg: Brak adresu.
sfStringValidator:
max: 255
max_error: Przekroczono dozwoloną liczbę znaków.
user_data{town}:
required:
msg: Brak miasta.
sfStringValidator:
max: 255
max_error: Przekroczono dozwoloną liczbę znaków.
user_data{code}:
required:
msg: Brak kodu.
sfStringValidator:
max: 255
max_error: Przekroczono dozwoloną liczbę znaków.
user_data{phone}:
required:
msg: Brak telefonu.
sfStringValidator:
max: 255
max_error: Przekroczono dozwoloną liczbę znaków.

View File

@@ -0,0 +1,32 @@
fields:
user_data{address}:
required:
msg: Brak adresu.
sfStringValidator:
max: 255
max_error: Przekroczono dozwoloną liczbę znaków.
user_data{town}:
required:
msg: Brak miasta.
sfStringValidator:
max: 255
max_error: Przekroczono dozwoloną liczbę znaków.
user_data{code}:
required:
msg: Brak kodu.
sfStringValidator:
max: 255
max_error: Przekroczono dozwoloną liczbę znaków.
user_data{phone}:
required:
msg: Brak telefonu.
sfStringValidator:
max: 255
max_error: Przekroczono dozwoloną liczbę znaków.