Example #1
0
<?php

include_partial('global/section', array('title' => 'Expert Tools'));
?>


<div class="padded margin_bottom">
<?php 
echo link_to('match related donors', LsListTable::getInternalUrl($list, 'matchRelated'));
?>
<br>
</div>
Example #2
0
<?php

slot('header_text', $list->name);
slot('header_link', $list->getInternalUrl());
slot('share_links', true);
?>

<?php 
if (isset($show_actions) && $show_actions) {
    ?>
  <?php 
    slot('header_actions', array('add member' => array('url' => $list->getInternalUrl('addEntity')), 'edit' => array('url' => $list->getInternalUrl('edit')), 'remove' => array('url' => $list->getInternalUrl('remove'), 'options' => 'post=true confirm=Are you sure you want to remove this list?', 'credential' => 'deleter'), 'add bulk' => array('url' => $list->getInternalUrl('addBulk'), 'credential' => 'bulker'), 'refresh' => array('url' => LsListTable::getInternalUrl($list, 'refresh', array('ref' => $sf_request->getUri())), 'credential' => 'admin')));
}
Example #3
0
<?php

include_partial('global/section', array('title' => 'Lists', 'pointer' => 'Analyst-created lists of people and orgs', 'action' => array('text' => 'add', 'url' => EntityTable::getInternalUrl($entity, 'addList'))));
?>

<div class="padded">
<?php 
foreach (EntityTable::getLsListsById($entity['id']) as $list) {
    ?>
  <?php 
    if (!$list['is_admin'] || $sf_user->hasCredential('editor')) {
        ?>
    <strong><?php 
        echo link_to(($list['is_admin'] ? '*' : '') . $list['name'], LsListTable::getInternalUrl($list));
        ?>
</strong>    
    <?php 
        if ($list['rank']) {
            ?>
      [#<?php 
            echo $list['rank'];
            ?>
]
    <?php 
        }
        ?>
    <?php 
        if ($sf_user->hasCredential('editor') && !$list['is_admin'] || $sf_user->hasCredential('admin')) {
            ?>
      <span class="text_small">
       (<?php 
Example #4
0
<br />
<br />

<?php 
echo list_link($list);
?>
 &nbsp;&larr;Member&rarr;&nbsp;
<strong>Entity Y</strong> &nbsp;&larr;Relationship&rarr;&nbsp;
<strong>Entity X</strong>

<br />
<br />

<form action="<?php 
echo url_for(LsListTable::getInternalUrl($list, 'networkSearch'));
?>
" method="GET">

<table style="width: auto;">
  <tr>
    <td>Relationship:</td>
    <td>
      <?php 
foreach ($categories as $id => $name) {
    ?>
        <?php 
    echo checkbox_tag('cat_ids[]', $id, in_array($id, explode(',', $cat_ids)));
    echo $name;
    ?>
      <?php 
Example #5
0
 public function executeAddBulk($request)
 {
     $this->checkList($request, false, false);
     $this->reference_form = new ReferenceForm();
     $this->reference_form->setSelectObject($this->list);
     $this->csv_form = new CsvUploadForm();
     if ($request->isMethod('post')) {
         $commit = $request->getParameter('commit');
         if ($commit == 'Cancel') {
             $this->redirect(LsListTable::getInternalUrl($this->list));
         }
         // IF REFERENCE INFO AND FILE HAVE BEEN SUBMITTED, LOAD DATA IN
         if ($request->hasParameter('reference') && $request->hasParameter('csv')) {
             $csvParams = $request->getParameter('csv');
             $filePath = $request->getFilePath('csv[file]');
             $this->csv_form->bind($csvParams, $request->getFiles('csv'));
             $refParams = $request->getParameter('reference');
             $this->reference_form->bind($refParams);
             if ($this->reference_form->isValid()) {
                 if ($spreadsheetArr = LsSpreadsheet::parse($filePath)) {
                     $names = $spreadsheetArr['rows'];
                     if (!in_array('name', $spreadsheetArr['headers'])) {
                         $request->setError('csv', 'The file you uploaded could not be parsed properly because there is no "name" column.');
                         return;
                     }
                 } else {
                     $request->setError('csv', 'The file you uploaded could not be parsed properly.');
                     return;
                 }
                 if ($this->ref_id = $refParams['existing_source']) {
                     $ref = Doctrine::getTable('Reference')->find($this->ref_id);
                     $url = $ref->source;
                 } else {
                     $ref = new Reference();
                     $ref->object_model = 'LsList';
                     $ref->object_id = $this->list->id;
                     $ref->source = $refParams['source'];
                     $ref->name = $refParams['name'];
                     $ref->source_detail = $refParams['source_detail'];
                     $ref->publication_date = $refParams['publication_date'];
                     $ref->save();
                     $this->ref_id = $ref->id;
                 }
                 $this->default_type = $request->getParameter('default_type');
                 if (!$this->default_type) {
                     $request->setError('csv', 'You need to choose a default type.');
                     return;
                 }
                 $this->extensions = ExtensionDefinitionTable::getByTier(2, $this->default_type);
                 $extensions_arr = array();
                 foreach ($this->extensions as $ext) {
                     $extensions_arr[] = $ext->name;
                 }
                 $this->matches = array();
                 if (isset($names) && count($names) > 0) {
                     for ($i = 0; $i < count($names); $i++) {
                         if (isset($names[$i]['name']) && trim($names[$i]['name']) != '') {
                             $name = $names[$i]['name'];
                             $name_terms = $name;
                             if ($this->default_type == 'Person') {
                                 $name_parts = preg_split('/\\s+/', $name);
                                 if (count($name_parts) > 1) {
                                     $name_terms = PersonTable::nameSearch($name, true);
                                 }
                                 $terms = $name_terms;
                                 $primary_ext = "Person";
                             } else {
                                 if ($this->default_type == 'Org') {
                                     $name_terms = OrgTable::nameSearch($name);
                                     $terms = $name_terms;
                                     $primary_ext = "Org";
                                 } else {
                                     $terms = $name_terms;
                                     $primary_ext = null;
                                 }
                             }
                             $pager = EntityTable::getSphinxPager($terms, $page = 1, $num = 20, $listIds = null, $aliases = true, $primary_ext);
                             $match = array('name' => $name);
                             $match['search_results'] = $pager->execute();
                             $match['blurb'] = isset($names[$i]['blurb']) ? $names[$i]['blurb'] : null;
                             $match['rank'] = isset($names[$i]['rank']) ? $names[$i]['rank'] : null;
                             $match['types'] = array();
                             if (isset($names[$i]['types'])) {
                                 $types = explode(',', $names[$i]['types']);
                                 $types = array_map('trim', $types);
                                 foreach ($types as $type) {
                                     if (in_array($type, $extensions_arr)) {
                                         $match['types'][] = $type;
                                     }
                                 }
                             }
                             $this->matches[] = $match;
                         }
                     }
                 }
             }
         } else {
             if ($request->hasParameter('ref_id')) {
                 $this->ref_id = $this->getRequestParameter('ref_id');
                 $entity_ids = array();
                 $default_type = $this->getRequestParameter('default_type');
                 for ($i = 0; $i < $this->getRequestParameter('count'); $i++) {
                     if ($entity_id = $request->getParameter('entity_' . $i)) {
                         $selected_entity_id = null;
                         if ($entity_id == 'new') {
                             $name = $request->getParameter('new_name_' . $i);
                             if ($default_type == 'Person') {
                                 $new_entity = PersonTable::parseFlatName($name);
                             } else {
                                 $new_entity = new Entity();
                                 $new_entity->addExtension('Org');
                                 $new_entity->name = trim($name);
                             }
                             if ($types = $request->getParameter('new_extensions_' . $i)) {
                                 foreach ($types as $type) {
                                     $new_entity->addExtension($type);
                                 }
                             }
                             $new_entity->save();
                             $new_entity->blurb = $request->getParameter('new_blurb_' . $i);
                             $ref = Doctrine::getTable('Reference')->find($request->getParameter('ref_id'));
                             $new_entity->addReference($ref->source, null, null, $ref->name);
                             $new_entity->save();
                             $selected_entity_id = $new_entity->id;
                         } else {
                             if ($entity_id > 0) {
                                 $selected_entity_id = $entity_id;
                             }
                         }
                         if ($selected_entity_id) {
                             $q = LsDoctrineQuery::create()->from('LsListEntity le')->where('le.list_id = ? AND le.entity_id = ?', array($this->list['id'], $selected_entity_id));
                             if (!$q->count()) {
                                 $ls_list_entity = new LsListEntity();
                                 $ls_list_entity->list_id = $this->list->id;
                                 $ls_list_entity->entity_id = $selected_entity_id;
                                 $ls_list_entity->rank = $request->getParameter('entity_' . $i . '_rank');
                                 $ls_list_entity->save();
                                 LsCache::clearEntityCacheById($selected_entity_id);
                             }
                         }
                     }
                 }
                 $this->clearCache($this->list);
                 $this->clearRailsCache($this->list->id);
                 $this->redirect($this->list->getInternalUrl());
             } else {
                 $request->setError('name', 'The name you entered is invalid');
             }
         }
     }
 }
Example #6
0
?>
  <br />
  
<?php 
if ($sf_user->hasCredential('bulker')) {
    ?>
  <?php 
    include_partial('list/expertlinks', array('list' => $list));
    ?>
  <br />
  
<?php 
}
?>
  <?php 
include_partial('global/notes', array('record' => $list, 'model' => 'LsList', 'more_uri' => LsListTable::getInternalUrl($list, 'notes')));
end_slot();
?>



<?php 
if ($list->is_admin) {
    ?>
  <em>This list is maintained by admin users. Please 
  <?php 
    echo link_to('contact us', 'home/contact');
    ?>
  if you would like to suggest changes.</em>
  <br />
  <br />