function trigger_autoports() { $object = spotEntity('object', getBypassValue()); amplifyCell($object); if (count($object['ports'])) { return ''; } return count(getAutoPorts($object['objtype_id'])) ? 'attn' : ''; }
function trigger_autoports() { $object_id = getBypassValue(); if (0 != getPortsCount($object_id)) { return ''; } $object = spotEntity('object', $object_id); return count(getAutoPorts($object)) ? 'attn' : ''; }
function executeAutoPorts($object_id = 0, $type_id = 0) { if ($object_id == 0) { throw new InvalidArgException('$object_id', $object_id); } if ($type_id == 0) { throw new InvalidArgException('$type_id', $type_id); } foreach (getAutoPorts($type_id) as $autoport) { commitAddPort($object_id, $autoport['name'], $autoport['type'], '', ''); } }
function renderAutoPortsForm($object_id) { $info = spotEntity('object', $object_id); $ptlist = getPortOIFOptions(); echo "<table class='widetable' border=0 cellspacing=0 cellpadding=5 align='center'>\n"; echo "<caption>The following ports can be quickly added:</caption>"; echo "<tr><th>type</th><th>name</th></tr>"; foreach (getAutoPorts($info['objtype_id']) as $autoport) { echo "<tr><td>" . $ptlist[$autoport['type']] . "</td><td>{$autoport['name']}</td></tr>"; } printOpFormIntro('generate'); echo "<tr><td colspan=2 align=center>"; echo "<input type=submit value='Generate'>"; echo "</td></tr>"; echo "</table></form>"; }
function trigger_autoports() { assertUIntArg('object_id'); $object = spotEntity('object', $_REQUEST['object_id']); amplifyCell($object); if (count($object['ports'])) { return ''; } return count(getAutoPorts($object['objtype_id'])) ? 'attn' : ''; }