18 require_once dirname(__FILE__).
'/../../page_templates/page_asset_builder/page_asset_builder_edit_fns.inc';
19 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
39 var $location_types = Array(
'user_group' =>
'D');
48 parent::__construct();
65 if (!$asset->writeAccess(
'attributes')) {
66 parent::paintAssetTypes($asset, $o, $prefix);
68 $user_types = $GLOBALS[
'SQ_SYSTEM']->am->getTypeDescendants(
'user');
70 $options = Array(
'user' =>
'User');
71 foreach ($user_types as $type_code) {
72 $info = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($type_code);
73 if ($info[
'allowed_access'] !=
'system' && $info[
'instantiable']) {
74 $options[$type_code] = $info[
'name'];
77 combo_box($prefix.
'_create_type', $options, FALSE, array_keys($asset->attr(
'create_type')));
98 if (isset($_POST[$prefix.
'_create_type'])) {
99 $type = trim($_POST[$prefix.
'_create_type']);
100 if (empty($type))
return FALSE;
101 $types = Array($type => TRUE);
102 $asset->setAttrValue(
'create_type', $types);
155 return $asset->attr(
'use_email_validation');
172 $write_access = $asset->writeAccess(
'attributes');
175 $all_users = $asset->_getPendingUserIds();
178 $total_assets = count($all_users);
180 $num_pages = ceil($total_assets / $num_per_page);
182 $asset_offset = array_get_index($_POST, $prefix.
'_asset_offset', 0);
183 hidden_field($prefix.
'_asset_offset', $asset_offset);
185 if ($num_pages <= 1) {
188 $users = array_slice($all_users, $asset_offset, $num_per_page);
192 <table
class=
"sq-backend-table">
194 <td
class=
"sq-backend-table-header-header" <?php echo ($write_access ?
'colspan="4"' :
''); ?>>
196 if ($asset_offset > 0) {
197 ?><a title=
"<?php echo translate('pagination_go_to_first') ?>" style=
"text-decoration: none; color: #fff" href=
"#" onClick=
"Javascript: set_hidden_field('<?php echo $prefix ?>_asset_offset', '0'); set_hidden_field('process_form', '0'); submit_form(); return false;"><?php
199 ?><span title=
"<?php echo translate('pagination_cannot_go_further_back') ?>" style=
"color: #333"><?php
204 if ($asset_offset > 0) {
209 ?> <?php
210 if ($asset_offset > 0) {
211 ?><a title=
"<?php echo translate('pagination_go_to_previous') ?>" style=
"text-decoration: none; color: #fff" href=
"#" onClick=
"Javascript: set_hidden_field('<?php echo $prefix ?>_asset_offset', '<?php echo $asset_offset - $num_per_page; ?>'); set_hidden_field('process_form', '0'); submit_form(); return false;"><?php
213 ?><span title=
"<?php echo translate('pagination_cannot_go_further_back') ?>" style=
"color: #333"><?php
218 if ($asset_offset > 0) {
224 <?php echo translate(
'page_number', round(($asset_offset + $num_per_page) / $num_per_page), ($total_assets > 0 ? ceil($total_assets / $num_per_page) : 1)); ?>
226 if (($asset_offset + $num_per_page) < $total_assets) {
227 ?><a title=
"<?php echo translate('pagination_go_to_next') ?>" style=
"text-decoration: none; color: #fff" href=
"#" onClick=
"Javascript: set_hidden_field('<?php echo $prefix ?>_asset_offset', '<?php echo $asset_offset + $num_per_page; ?>'); set_hidden_field('process_form', '0'); submit_form(); return false;"><?php
229 ?><span title=
"<?php echo translate('pagination_cannot_go_further_forward') ?>" style=
"color: #333"><?php
234 if (($asset_offset + $num_per_page) < $total_assets) {
239 ?> <?php
240 if (($asset_offset + $num_per_page) < $total_assets) {
241 ?><a title=
"<?php echo translate('pagination_go_to_last') ?>" style=
"text-decoration: none; color: #fff" href=
"#" onClick=
"Javascript: set_hidden_field('<?php echo $prefix ?>_asset_offset', '<?php echo ($num_pages - 1) * $num_per_page; ?>'); set_hidden_field('process_form', '0'); submit_form(); return false;"><?php
243 ?><span title=
"<?php echo translate('pagination_cannot_go_further_forward') ?>" style=
"color: #333"><?php
248 if (($asset_offset + $num_per_page) < $total_assets) {
257 <td
class=
"sq-backend-table-header"><?php echo translate(
'user'); ?></td>
260 ?><td
class=
"sq-backend-table-header"><?php echo translate(
'cms_account_manager_validate'); ?></td><?php
261 ?><td
class=
"sq-backend-table-header"><?php echo translate(
'delete_question'); ?></td><?php
267 $user_details = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo($users, Array(), TRUE,
'name');
268 foreach ($users as $userid) {
270 <td
class=
"sq-backend-table-cell"><?php echo get_asset_tag_line($userid,
'details'); ?></td>
274 $name = $prefix.
'_validate_action['.$userid.
']';
275 ?><td width=
"10%" class=
"sq-backend-table-cell" style=
"text-align: center;"><?php
276 check_box($name,
'validate', FALSE,
'document.getElementById(\''.$prefix.
'_delete_'.$userid.
'\').checked=0
', 'id=
"'.$prefix.'_validate_'.$userid.'"');
278 ?><td width="10%" class="sq-backend-table-cell" style="text-align: center;"><?php
279 check_box($name, 'delete', FALSE, 'document.getElementById(\
''.$prefix.
'_validate_'.$userid.
'\').checked=0
', 'id=
"'.$prefix.'_delete_'.$userid.'"');
292 return $write_access;
294 }//end paintValidateAccounts()
307 function processValidateAccounts(&$asset, &$o, $prefix)
309 $write_access = $asset->writeAccess('attributes
');
311 $pending_users = array_get_index($_REQUEST, $prefix.'_validate_action
', Array());
313 $user_actions = Array();
314 foreach ($pending_users as $userid => $action) {
315 if (empty($action)) continue;
316 $user_actions[$action][] = $userid;
319 // validate some users
320 if (!empty($user_actions['validate
'])) {
321 // queue up a hipo to loop through the users, validating each one
322 quick_hipo($asset->id, 'hipoValidateUser
', $user_actions['validate
'], Array(), TRUE);
326 if (!empty($user_actions['delete'])) {
327 // queue up a hipo to loop through the users, deleting them
328 quick_hipo($asset->id, 'hipoDeleteUser
', $user_actions['delete'], Array(), TRUE);
331 return $write_access;
333 }//end processValidateAccounts()
346 function paintCreateFormCustomisation(&$asset, &$o, $prefix)
348 $customised_types = $asset->attr('create_form_customisations
');
349 $wa = $asset->writeAccess('attributes
');
351 hidden_field($prefix.'_customise_form_submitted
', 1);
352 echo check_box($prefix.'_customise_form
', 1, !empty($customised_types));
353 label(translate('cms_account_manager_customise_create_form
'), $prefix.'_customise_form
');
355 $fn = !empty($customised_types) ? 'tick
' : 'cross
';
356 echo '<img src=
"'.sq_web_path('lib').'/web/images/'.$fn.'.gif" />
';
357 echo translate('cms_account_manager_customise_create_form
');
360 }//end paintCreateFormCustomisation()
373 function processCreateFormCustomisation(&$asset, &$o, $prefix)
375 if ($asset->writeAccess('attributes
') && isset($_POST[$prefix.'_customise_form_submitted
'])) {
376 $customise = array_get_index($_POST, $prefix.'_customise_form
');
377 $customised_types = $customise ? array_keys($asset->attr('create_type
')) : Array();
378 return $asset->setAttrValue('create_form_customisations
', $customised_types);
382 }//end processCreateFormCustomisation()
395 function paintUseEmailValidation(&$asset, &$o, $prefix)
397 $write_access = $asset->writeAccess('links
');
398 $current_value = $asset->attr('use_email_validation
');
399 $options = Array(1 => 'Yes
', 0 => 'No
');
402 combo_box($prefix.'_use_email_validation
', $options, FALSE, $current_value);
404 echo $options[$current_value];
407 return $write_access;
409 }//end paintEmailValidation()
422 function processUseEmailValidation(&$asset, &$o, $prefix)
424 if (isset($_POST[$prefix.'_use_email_validation
'])) {
426 $use_email_validation = $_POST[$prefix.'_use_email_validation
'];
427 if ($asset->setAttrValue('use_email_validation
', $use_email_validation) && $use_email_validation) {
429 // if we are using email validation - create validation assets
430 $pending_accounts_groupid = $asset->_getPendingAccountsGroupId();
431 if (empty($pending_accounts_groupid)) {
432 $asset->_createPendingAccountsGroup();
440 }//end processEmailValidation()