Skip to content

Instantly share code, notes, and snippets.

@Swader
Created September 13, 2012 00:50
Show Gist options
  • Select an option

  • Save Swader/3711071 to your computer and use it in GitHub Desktop.

Select an option

Save Swader/3711071 to your computer and use it in GitHub Desktop.
Contacts List View
<?php
$this->searchForm->prepare();
echo $this->form()->openTag($this->searchForm);
echo $this->formRow($this->searchForm->get('validity'));
echo $this->formRow($this->searchForm->get('deleted'));
echo $this->formRow($this->searchForm->get('activated'));
echo $this->formInput($this->searchForm->get('search'));
echo $this->formRow($this->searchForm->get('submit'));
echo $this->form()->closeTag($this->searchForm);
if ($this->search && empty($this->result['rowSet'])) {
?> <h3>No results found. Please refine your search.</h3> <?php
} else if (!$this->search) {
?> <h3>Use the filters above and the search box in the header to search the contact base.</h3> <?php
} else {
if ($this->result['rowCount'] > 1) :
?> <h3>A total of <?php echo $this->result['rowCount']; ?> results were found.</h3>
<?php else : ?>
<h3>1 result was found.</h3>
<?php endif; ?>
<table class="backEndDatagrid">
<thead>
<tr>
<th>Id</th>
<th>Email</th>
<th>Account</th>
<th>Activated</th>
<th>Validity</th>
<th>Options</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->result['rowSet'] as $oContact) : ?>
<tr>
<td><?php echo $oContact->getId(); ?></td>
<td>
<?php echo $oContact->getEmail(); ?>
</td>
<td>
<?php if ($oContact->getAccountId()) : ?>
<?php echo ($oContact->isMain()) ? 'Main for ' : ''; ?>
<a href="/manager/users/list/search/yes/q/<?php echo $oContact->getAccountId() ?>"
title="Search for this account"><?php echo $oContact->getAccountId() ?></a>
<?php else : ?>
No account
<?php endif; ?>
</td>
<td><?php echo $oContact->isActivated() ? 'Yes' : 'No'; ?></td>
<td>
<?php echo $oContact->getValid(true); ?>
</td>
<td>
<?php if (!$oContact->isMain()) : ?>
<?php if ($oContact->isDeleted()) : ?>
<a href="javascript:void(0)"
onclick='managerDeleteContactForm(<?php echo $oContact->getId(); ?>, "<?php echo $oContact->getEmail(); ?>", "undelete")'
title="Undelete <?php echo $oContact->getEmail(); ?>">Undelete</a>
<?php else : ?>
<a href="javascript:void(0)"
onclick='managerDeleteContactForm(<?php echo $oContact->getId(); ?>, "<?php echo $oContact->getEmail(); ?>", "delete")'
title="Delete <?php echo $oContact->getEmail(); ?>">Delete</a>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php
echo $this->pagination;
}
?>
<div id="backend-dialogDeleteContactForm" style="display: none;">
<form method="post">
<p>Really <span id="managerDeleteContactForm_Actiontext"></span> contact <span
id="managerDeleteContactForm_Name"></span> (<span id="managerDeleteContactForm_Id"></span>)
</p>
<input type="hidden" name="contactId" id="managerDeleteContactForm_hiddenId"/>
</form>
</div>
<script type="text/javascript">
function managerDeleteContactForm(id, email, actiontext) {
$("#backend-dialogDeleteContactForm form").attr('action', '/manager/contacts/' + actiontext);
$("#managerDeleteContactForm_Name").text(email);
$("#managerDeleteContactForm_Id").text(id);
$("#managerDeleteContactForm_hiddenId").val(id);
$("#managerDeleteContactForm_Actiontext").text(actiontext);
$("#backend-dialogDeleteContactForm").dialog({
title :"Really " + actiontext + "?",
modal :true,
buttons:{
Confirm:function () {
$(this).find('form').submit();
},
Cancel :function () {
$(this).dialog("close");
}
}
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment