Example #1
0
 /**
  * Recursive function to get all descendent notes of the note with given ID.
  *
  * @param int $parentId
  *   ID of the note to start from.
  * @param int $maxDepth
  *   Maximum number of levels to descend into the tree; if not given, will include all descendents.
  * @param bool $snippet
  *   If TRUE, returned values will be pre-formatted for display in a table of notes.
  * @param array $tree
  *   (Reference) Variable to store all found descendents.
  * @param int $depth
  *   Depth of current iteration within the descendent tree (used for comparison against maxDepth).
  *
  * @return array
  *   Nested associative array beginning with direct children of given note.
  */
 private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0)
 {
     if ($maxDepth && $depth > $maxDepth) {
         return FALSE;
     }
     // get direct children of given parentId note
     $note = new CRM_Core_DAO_Note();
     $note->entity_table = 'civicrm_note';
     $note->entity_id = $parentId;
     $note->orderBy('modified_date asc');
     $note->find();
     while ($note->fetch()) {
         // foreach child, call this function, unless the child is private/hidden
         if (!self::getNotePrivacyHidden($note)) {
             CRM_Core_DAO::storeValues($note, $tree[$note->id]);
             // get name of user that created this note
             $contact = new CRM_Contact_DAO_Contact();
             $createdById = $note->contact_id;
             $contact->id = $createdById;
             $contact->find();
             $contact->fetch();
             $tree[$note->id]['createdBy'] = $contact->display_name;
             $tree[$note->id]['createdById'] = $createdById;
             $tree[$note->id]['modified_date'] = CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
             // paper icon view for attachments part
             $paperIconAttachmentInfo = CRM_Core_BAO_File::paperIconAttachment('civicrm_note', $note->id);
             $tree[$note->id]['attachment'] = $paperIconAttachmentInfo ? implode('', $paperIconAttachmentInfo) : '';
             if ($snippet) {
                 $tree[$note->id]['note'] = nl2br($tree[$note->id]['note']);
                 $tree[$note->id]['note'] = smarty_modifier_mb_truncate($tree[$note->id]['note'], 80, '...', TRUE);
                 CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
             }
             self::buildNoteTree($note->id, $maxDepth, $snippet, $tree[$note->id]['child'], $depth + 1);
         }
     }
     return $tree;
 }
        echo '</td><td><a href="';
        echo CRM_Utils_System::crmURL(array('p' => 'civicrm/contact/view', 'q' => "reset=1&cid=" . $this->_tpl_vars['row']['contact_id']), $this);
        echo '">';
        echo $this->_tpl_vars['row']['sort_name'];
        echo '</a></td><td>';
        echo is_array($_tmp = $this->_tpl_vars['row']['street_address']) ? $this->_run_mod_handler('mb_truncate', true, $_tmp, 22, "...", true) : smarty_modifier_mb_truncate($_tmp, 22, "...", true);
        echo '</td><td>';
        echo $this->_tpl_vars['row']['city'];
        echo '</td><td>';
        echo $this->_tpl_vars['row']['state_province'];
        echo '</td><td>';
        echo $this->_tpl_vars['row']['postal_code'];
        echo '</td><td>';
        echo $this->_tpl_vars['row']['country'];
        echo '</td><td>';
        echo is_array($_tmp = $this->_tpl_vars['row']['email']) ? $this->_run_mod_handler('mb_truncate', true, $_tmp, 17, "...", true) : smarty_modifier_mb_truncate($_tmp, 17, "...", true);
        echo '</td><td>';
        echo $this->_tpl_vars['row']['phone'];
        echo '</td><td>';
        echo $this->_tpl_vars['row']['action'];
        echo '</td></tr>';
    }
}
unset($_from);
echo '</table>';
?>


 <script type="text/javascript">
     var fname = "<?php 
echo $this->_tpl_vars['form']['formName'];
Example #3
0
 /**
  * Recursive function to get all descendent notes of the note with given ID
  * @param int $parentId ID of the note to start from
  * @param int $maxDepth Maximum number of levels to descend into the tree; if not given, will include all descendents.
  * @param bool $snippet If TRUE, returned values will be pre-formatted for display in a table of notes.
  * @param array $tree (Reference) Variable to store all found descendents
  * @param int $depth Depth of current iteration within the descendent tree (used for comparison against maxDepth)
  * @return array Nested associative array beginning with direct children of given note.
  */
 private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0)
 {
     if ($maxDepth && $depth > $maxDepth) {
         return;
     }
     // get direct children of given parentId note
     $note = new CRM_Core_DAO_Note();
     $note->entity_table = 'civicrm_note';
     $note->entity_id = $parentId;
     $note->orderBy('modified_date asc');
     $note->find();
     while ($note->fetch()) {
         // foreach child, call this function, unless the child is private/hidden
         if (!self::getNotePrivacyHidden($note)) {
             CRM_Core_DAO::storeValues($note, $tree[$note->id]);
             // get name of user that created this note
             require_once 'CRM/Contact/DAO/Contact.php';
             require_once 'CRM/Core/Smarty/plugins/modifier.mb_truncate.php';
             $contact = new CRM_Contact_DAO_Contact();
             $createdById = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $parentId, 'entity_id');
             $contact->id = $createdById;
             $contact->find();
             $contact->fetch();
             $tree[$note->id]['createdBy'] = $contact->display_name;
             $tree[$note->id]['createdById'] = $createdById;
             $tree[$note->id]['modified_date'] = CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
             if ($snippet) {
                 $tree[$note->id]['note'] = nl2br($tree[$note->id]['note']);
                 $tree[$note->id]['note'] = smarty_modifier_mb_truncate($tree[$note->id]['note'], 80, '...', TRUE);
                 CRM_Utils_Date::customFormat($tree[$note->id]['modified_date']);
             }
             self::buildNoteTree($note->id, $maxDepth, $snippet, $tree[$note->id]['child'], $depth + 1);
         }
     }
     return $tree;
 }
                ?>
<a href="<?php 
                echo $this->_tpl_vars['url'];
                ?>
&amp;continent_zoom=<?php 
                echo $this->_tpl_vars['raw']['continent'];
                ?>
#a<?php 
                echo $this->_tpl_vars['a'];
                ?>
">
<?php 
            }
            ?>
	<?php 
            echo is_array($_tmp = $this->_tpl_vars['raw']['data']) ? $this->_run_mod_handler('mb_truncate', true, $_tmp, 60, '...') : smarty_modifier_mb_truncate($_tmp, 60, '...');
            ?>

	<?php 
            if ($this->_tpl_vars['raw']['url'] || $this->_tpl_vars['id'] == 'world') {
                ?>
</a>
<?php 
            }
            ?>
</strong>
</td>
<td <?php 
            if ($this->_tpl_vars['style']) {
                ?>
class="<?php 
                            echo smarty_block_ts($this->_tag_stack[count($this->_tag_stack) - 1][1], $_block_content, $this, $_block_repeat);
                        }
                        array_pop($this->_tag_stack);
                        ?>
</td>
                                                <td <?php 
                        if ($this->_tpl_vars['item']['is_primary'] == 1) {
                            ?>
class="primary"<?php 
                        }
                        ?>
><a href="<?php 
                        echo $this->_tpl_vars['item']['openid'];
                        ?>
"><?php 
                        echo is_array($_tmp = $this->_tpl_vars['item']['openid']) ? $this->_run_mod_handler('mb_truncate', true, $_tmp, 40) : smarty_modifier_mb_truncate($_tmp, 40);
                        ?>
</a>
                                                    <?php 
                        if ($this->_tpl_vars['config']->userFramework == 'Standalone' && $this->_tpl_vars['item']['allowed_to_login'] == 1) {
                            ?>
                                                        <br/> <span style="font-size:9px;"><?php 
                            $this->_tag_stack[] = array('ts', array());
                            $_block_repeat = true;
                            smarty_block_ts($this->_tag_stack[count($this->_tag_stack) - 1][1], null, $this, $_block_repeat);
                            while ($_block_repeat) {
                                ob_start();
                                ?>
(Allowed to login)<?php 
                                $_block_content = ob_get_contents();
                                ob_end_clean();
                ?>
" /><?php 
            }
            if ($this->_tpl_vars['id'] == 'refererssearchenginesdetails') {
                ?>
	<?php 
                $this->assign('limit', 40);
                ?>
 
<?php 
            } else {
                ?>
	<?php 
                $this->assign('limit', 55);
            }
            echo is_array($_tmp = $this->_tpl_vars['raw']['data']) ? $this->_run_mod_handler('mb_truncate', true, $_tmp, $this->_tpl_vars['limit'], "...", true) : smarty_modifier_mb_truncate($_tmp, $this->_tpl_vars['limit'], "...", true);
            ?>

<?php 
            if ($this->_tpl_vars['raw']['url']) {
                ?>
</a><?php 
            }
            ?>
</td>
<td class="subLevel nb"  width="120px" nowrap="nowrap"><?php 
            echo $this->_tpl_vars['raw']['sum'];
            ?>
 (<?php 
            echo is_array($_tmp = $this->_tpl_vars['raw']['percent']) ? $this->_run_mod_handler('string_format', true, $_tmp, "%.2f") : smarty_modifier_string_format($_tmp, "%.2f");
            ?>
    <?php $_from = $this->_tpl_vars['recentlyViewed']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
         <li class="crm-recently-viewed" ><a  href="<?php echo $this->_tpl_vars['item']['url']; ?>
" title="<?php echo $this->_tpl_vars['item']['title']; ?>
">
         <?php if ($this->_tpl_vars['item']['image_url']): ?>
            <span class="icon crm-icon <?php if ($this->_tpl_vars['item']['subtype']): ?><?php echo $this->_tpl_vars['item']['subtype']; ?>
<?php else: ?><?php echo $this->_tpl_vars['item']['type']; ?>
<?php endif; ?>-icon" style="background: url('<?php echo $this->_tpl_vars['item']['image_url']; ?>
')"></span>
         <?php else: ?>
            <span class="icon crm-icon <?php echo $this->_tpl_vars['item']['type']; ?>
<?php if ($this->_tpl_vars['item']['subtype']): ?>-subtype<?php endif; ?>-icon"></span>
         <?php endif; ?>
         <?php if ($this->_tpl_vars['item']['isDeleted']): ?><del><?php endif; ?><?php echo ((is_array($_tmp=$this->_tpl_vars['item']['title'])) ? $this->_run_mod_handler('mb_truncate', true, $_tmp, 25, "..", true) : smarty_modifier_mb_truncate($_tmp, 25, "..", true)); ?>
<?php if ($this->_tpl_vars['item']['isDeleted']): ?></del><?php endif; ?></a>
         <div class="crm-recentview-wrapper">
           <a href='<?php echo $this->_tpl_vars['item']['url']; ?>
' class="crm-actions-view"><?php $this->_tag_stack[] = array('ts', array()); $_block_repeat=true;smarty_block_ts($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?>View<?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false;echo smarty_block_ts($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); }  array_pop($this->_tag_stack); ?></a>
         <?php if ($this->_tpl_vars['item']['edit_url']): ?><a href='<?php echo $this->_tpl_vars['item']['edit_url']; ?>
' class="crm-actions-edit"><?php $this->_tag_stack[] = array('ts', array()); $_block_repeat=true;smarty_block_ts($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?>Edit<?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false;echo smarty_block_ts($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); }  array_pop($this->_tag_stack); ?></a><?php endif; ?>
       <?php if ($this->_tpl_vars['item']['delete_url']): ?><a href='<?php echo $this->_tpl_vars['item']['delete_url']; ?>
' class="crm-actions-delete"><?php $this->_tag_stack[] = array('ts', array()); $_block_repeat=true;smarty_block_ts($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?>Delete<?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false;echo smarty_block_ts($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); }  array_pop($this->_tag_stack); ?></a><?php endif; ?>
         </div>
       </li>
    <?php endforeach; endif; unset($_from); ?>
   </ul>
</div>
<?php echo '
<script type="text/javascript">
                echo $this->_tpl_vars['item']['type'];
                if ($this->_tpl_vars['item']['subtype']) {
                    ?>
-subtype<?php 
                }
                ?>
-icon"></span>
         <?php 
            }
            ?>
         <?php 
            if ($this->_tpl_vars['item']['isDeleted']) {
                ?>
<del><?php 
            }
            echo is_array($_tmp = $this->_tpl_vars['item']['title']) ? $this->_run_mod_handler('mb_truncate', true, $_tmp, 25, "..", true) : smarty_modifier_mb_truncate($_tmp, 25, "..", true);
            if ($this->_tpl_vars['item']['isDeleted']) {
                ?>
</del><?php 
            }
            ?>
</a>
         <div class="crm-recentview-wrapper">
           <a href='<?php 
            echo $this->_tpl_vars['item']['url'];
            ?>
' class="crm-actions-view"><?php 
            $this->_tag_stack[] = array('ts', array());
            $_block_repeat = true;
            smarty_block_ts($this->_tag_stack[count($this->_tag_stack) - 1][1], null, $this, $_block_repeat);
            while ($_block_repeat) {
Example #9
0
 echo '<tr id="row_';
 echo $this->_tpl_vars['row']['id'];
 echo '"class="';
 echo smarty_function_cycle(array('values' => "odd-row,even-row"), $this);
 echo ' ';
 echo $this->_tpl_vars['row']['class'];
 echo '';
 if (!$this->_tpl_vars['row']['is_active']) {
     echo ' disabled';
 }
 echo '"><td>';
 echo $this->_tpl_vars['row']['title'];
 echo '</td><td>';
 echo $this->_tpl_vars['row']['id'];
 echo '</td><td>';
 echo is_array($_tmp = $this->_tpl_vars['row']['description']) ? $this->_run_mod_handler('mb_truncate', true, $_tmp, 80, "...", true) : smarty_modifier_mb_truncate($_tmp, 80, "...", true);
 echo '</td><td>';
 echo $this->_tpl_vars['row']['group_type'];
 echo '</td><td>';
 echo $this->_tpl_vars['row']['visibility'];
 echo '</td>';
 if ($this->_tpl_vars['groupOrg']) {
     echo '<td><a href="';
     echo CRM_Utils_System::crmURL(array('p' => 'civicrm/contact/view', 'q' => "reset=1&cid=" . $this->_tpl_vars['row']['org_id']), $this);
     echo '">';
     echo $this->_tpl_vars['row']['org_name'];
     echo '</a></td>';
 }
 echo '<td>';
 echo is_array($_tmp = $this->_tpl_vars['row']['action']) ? $this->_run_mod_handler('replace', true, $_tmp, 'xx', $this->_tpl_vars['row']['id']) : smarty_modifier_replace($_tmp, 'xx', $this->_tpl_vars['row']['id']);
 echo '</td></tr>';